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 :

<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();">

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.