| | |
close event for firefox
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2005
Posts: 4
Reputation:
Solved Threads: 0
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]
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.
Hi fuehrer,
if you check this code using firefox in Javascript Console,you'll figure out that it throws this error:
So,it won't work in firefox till you change the onbeforeunload event.
Good luck.
if you check this code using firefox in Javascript Console,you'll figure out that it throws this error:
•
•
•
•
Error: event is not defined
Good luck.
![]() |
Similar Threads
- Creating an event or an action to a button. (PHP)
- Microsoft Internet Explorer Wont Allow to Close (Web Browsers)
- Windows program closing automatically on opening- HIJACK LOG posted (Viruses, Spyware and other Nasties)
- wanna help..how to avoid default context menu (JavaScript / DHTML / AJAX)
- HJT log please check, causing serious boot probs (Viruses, Spyware and other Nasties)
- scanned with hijack. what do I fix?? (Viruses, Spyware and other Nasties)
- Loing authentication fields from 2 tables? (ASP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: DateTime - TimeZone conversion with Javascript. Partially working!
- Next Thread: Copy text to clipboard
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug captchaformproblem checkbox close codes createrange() css cursor debugger decimal dependent disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox form forms frameworks getselection google gwt hiddenvalue hint html htmlform ie7 ie8 iframe index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jsp jump listbox maps masterpage math media menu microsoft mp4 object onmouseoutdivproblem onreadystatechange paypal php player position problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c window windowofwords windowsxp wysiwyg \n





