coletteck8
asked on
close popup at page unload
how do i close a popup when the user leaves that page? i am using the popup function below:
<script language = "javascript">
function popup()
{
var win
win = window.open("HelpFile/aler t.htm", "Help", "width = 500, height = 300, top = 50, left = 450, scrollbars = no, resizable = no");
}
</script>
<script language = "javascript">
function popup()
{
var win
win = window.open("HelpFile/aler
}
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Apologies Zyloch.
ASKER
i'm getting an error win undefined
ASKER
this is what i have
<script language = "javascript">
function popup()
{
var win;
win = window.open("HelpFile/aler t.htm", "Help", "width = 500, height = 300, top = 50, left = 450, scrollbars = no, resizable = no");
}
</script>
<body onunload = "if (win &&!win.closed){win.close() ;}">
<script language = "javascript">
function popup()
{
var win;
win = window.open("HelpFile/aler
}
</script>
<body onunload = "if (win &&!win.closed){win.close()
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No prob, cLFlaVa, I'm just experiencing an onrush of questions after two weeks of very difficult school lol
Hmm... It should work. Try this:
if (Help && !Help.closed) {Help.close();}
But before should work. Make sure that your popup opens before you close.
Hmm... It should work. Try this:
if (Help && !Help.closed) {Help.close();}
But before should work. Make sure that your popup opens before you close.
Ah, so now it's my turn cL :)
hehe
ASKER
OF course. i'm losing my mind here! thanks so much to both of you.
Something like this in your body tag:
<body onunload="if (win && !win.closed) { win.close(); }">