sanrich
asked on
javascript on browser close button
Hi,
I got one javascript which is solving my issue but I need your help to make it completly working. In the enclosed javascript when I click browser close button then popup is appearing fine. It provides me two option "ok" and "cancel". When I click "ok" button then it is not showing me alert.
alert("Window is closed");
Can you please help. I am enclosing code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD> <TITLE> Window Close Test </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT="">
<script type="text/javascript">
var myclose = false;
function ConfirmClose(){
if (event.clientY < 0)
{
event.returnValue = 'Any message you want';
setTimeout('myclose=false' ,100);
myclose=true;
}
}
function HandleOnClose() {
if (myclose==true) {
alert("Window is closed");
//you can write your specific code here to call action
}
}
</script>
</HEAD>
<BODY>
<body onbeforeunload="ConfirmClo se()" onunload="HandleOnClose()" >
<input type="submit" name="add" id="add" value=" ADD " tabindex="19" />
<input type="submit" name="edit" id="edit" value=" EDIT " tabindex="20" />
<input type="submit" name="delete" id="delete" value="DELETE" tabindex="21" />
</BODY></HTML>
I got one javascript which is solving my issue but I need your help to make it completly working. In the enclosed javascript when I click browser close button then popup is appearing fine. It provides me two option "ok" and "cancel". When I click "ok" button then it is not showing me alert.
alert("Window is closed");
Can you please help. I am enclosing code
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><HTML> <HEAD> <TITLE> Window Close Test </TITLE> <META NAME="Generator" CONTENT="EditPlus"> <META NAME="Author" CONTENT=""> <META NAME="Keywords" CONTENT=""> <META NAME="Description" CONTENT="">
<script type="text/javascript">
var myclose = false;
function ConfirmClose(){
if (event.clientY < 0)
{
event.returnValue = 'Any message you want';
setTimeout('myclose=false'
myclose=true;
}
}
function HandleOnClose() {
if (myclose==true) {
alert("Window is closed");
//you can write your specific code here to call action
}
}
</script>
</HEAD>
<BODY>
<body onbeforeunload="ConfirmClo
<input type="submit" name="add" id="add" value=" ADD " tabindex="19" />
<input type="submit" name="edit" id="edit" value=" EDIT " tabindex="20" />
<input type="submit" name="delete" id="delete" value="DELETE" tabindex="21" />
</BODY></HTML>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.