| | |
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 array automatically beta box browser bug calendar captchaformproblem cart checkbox close codes column createrange() css cursor date debugger decimal dependent design dom download dropdown element embed enter error events firefox focus form frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsfile jsp libcurl listbox maps masterpage media menu microsoft mimic mp4 onmouseover paypal php player position post problem programming progressbar prototype redirect regex runtime safari scale scriptlets search security select size software sql text textarea unicode w3c website window windowofwords windowsxp





