User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 391,808 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,474 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3809 | Replies: 1
Reply
Join Date: Aug 2005
Posts: 4
Reputation: fuehrer is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
fuehrer fuehrer is offline Offline
Newbie Poster

close event for firefox

  #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 9:48 am. Reason: User ignored rules about code tags.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jul 2006
Posts: 137
Reputation: mostafadotnet is on a distinguished road 
Rep Power: 3
Solved Threads: 7
mostafadotnet's Avatar
mostafadotnet mostafadotnet is offline Offline
Junior Poster

Re: close event for firefox

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb JavaScript / DHTML / AJAX Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 5:32 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC