I wrote the following code such that when user close my webpage or netvigate to other page, a message box pop up:
- <head>
-
<SCRIPT>
-
function closeIt()
-
{
-
event.returnValue = "Any unsaved data will be lost.";
-
}
-
</SCRIPT>
-
</head>
-
<BODY onBeforeUnload="closeIt()">
but in my webpage there is some dropdown list, and everytime when the selected index of dropdown list changed, there is an auto post back. so everytime when i select something from the dropdown list, the message appears even i'm not leaving the page. Is there any ways that my message box will appear
only when the user close the webpage or netvigate to somewhere else?