subeeshkk
08-06-2008, 04:35 AM
Hi All,
I am basically new to the web world. I would like to thank you for your time with my question, in advance.
My issue is that, I want a confirmation box before closing my window. I have done this using the event 'onbeforeunload'. It works fine , but the problem is that, the event is been generated when I move to next page or refresh the same page. I want this confirmation only when closing the window.
The code goes like this
***********************
<html>
<head>
<title>Testing</title>
<script language="JavaScript">
<!--
window.onbeforeunload = bunload;
function bunload(){
dontleave="Are you sure you want to leave?";
return dontleave;
}
//-->
</script>
</head>
<body>
Please stay on this page!
</body>
</html>
***********************
Please help me,
Thank You
Subeesh.K.K
I am basically new to the web world. I would like to thank you for your time with my question, in advance.
My issue is that, I want a confirmation box before closing my window. I have done this using the event 'onbeforeunload'. It works fine , but the problem is that, the event is been generated when I move to next page or refresh the same page. I want this confirmation only when closing the window.
The code goes like this
***********************
<html>
<head>
<title>Testing</title>
<script language="JavaScript">
<!--
window.onbeforeunload = bunload;
function bunload(){
dontleave="Are you sure you want to leave?";
return dontleave;
}
//-->
</script>
</head>
<body>
Please stay on this page!
</body>
</html>
***********************
Please help me,
Thank You
Subeesh.K.K