close event for firefox

Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Reply

Join Date: Aug 2005
Posts: 4
Reputation: fuehrer is an unknown quantity at this point 
Solved Threads: 0
fuehrer fuehrer is offline Offline
Newbie Poster

close event for firefox

 
0
  #1
Aug 29th, 2006
Hi guys,

i'm new to JS and need a little help on this issue of mine.....

i'm trying to popup a confirm dialog box whenever i close my browser window,the problem is that i'm able to do this in IE but i'm having problems when i'm using firefox.i'm doing this using the "onbeforeunload" event.........

Please do gimme a solution to this problem in forefox and also let me know y this is happening.................


The script that i've ritten is :
[html]
<script language="JavaScript">

function ConfirmLeaving()
{
if (event.clientY < 0 && event.clientX > 600)
{
var answer = confirm ("do u want to go to google?");
if (answer)
{
window.open("http://www.google.com");
}
}
}
</script>

</HEAD>
<body onbeforeunload="ConfirmLeaving();">[/html]
Last edited by tgreer; Aug 29th, 2006 at 10:48 am. Reason: User ignored rules about code tags.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 155
Reputation: mostafadotnet is on a distinguished road 
Solved Threads: 10
mostafadotnet's Avatar
mostafadotnet mostafadotnet is offline Offline
Junior Poster

Re: close event for firefox

 
0
  #2
Aug 29th, 2006
Hi fuehrer,
if you check this code using firefox in Javascript Console,you'll figure out that it throws this error:
Error: event is not defined
So,it won't work in firefox till you change the onbeforeunload event.
Good luck.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC