Close pop up

hi,can somebody post the script for putting in a button to close a Javasacript pop-up?
thx

say your code looks something like this to open the window:

var win = window.open(…);

now “win” is the variable you can use to control the pop-up.

now you can go:

win.close();

to close that pop-up.

If you are doing that from a flash movie, don’t you have to have the getURL thing too? I don’t know, I’ve never done it so I’m asking for my own information:


on(release){
getURL("javascript:window.close();");
}

I don’t even know if that would work…would it?

I think you can also do it like this: when you called the pop-up through window.open, you can assign a name to the window. window.open(URL, name, properties); so an example would be window.open(‘http://www.site.com’, ‘site’, ‘…’); , where ‘site’ is the name given to the pop-up.

When using window.close();, I think you have to give the name of the window to close, so that would be window.close(‘site’);
So in Flash, that would become getURL(“java**script:window.close(‘site’);”);

Unless that swf is in the window that you want to close, then you don’t need that parameter, right? Javascript will close the window with that one line from itself…I think. I know if you go to your address bar no matter where you are and put in ‘javascript:window.close’, it’ll close that window.

getURL("javascript : window.close();","_top");

—> (remove spaces between “javascript”, “:” and “window…”)

DP, try adding an [ i ][ /i] (without spaces of course) at the beginning of the letter j in javascript.

[AS]getURL(“javascript: window.close();”,"_top");[/AS]

DP ?

*Originally posted by Freddythunder *
**Unless that swf is in the window that you want to close, then you don’t need that parameter, right? Javascript will close the window with that one line from itself…I think. I know if you go to your address bar no matter where you are and put in ‘javascript:window.close’, it’ll close that window. **

Correct :slight_smile: Didn’t think of that, but you can use it anyway to close pop-ups from the another window =)

Right, good. I actually really didn’t know, so it’s good to know if I ever need to use that. Thanks Voetsjoeba!!