how to show alert on refresh and window close

Posted by Vineeth1311 under JavaScript on 4/23/2009 | Views : 14566 | Status : [Member] | Replies : 2
how to show alert on refresh and window close




Responses

Posted by: Majith on: 4/23/2009 [Member] Starter

Up
0
Down
Greetings Vineeth,


For the window.close Alert Message call the javascript method on Body OnUnload Event.

 <script language="javascript" type="text/javascript">   	    

function shut1()
{
alert("Bye");
}
</script>


<body onunload="shut1()" >

For the Refresh Alert Message call the following javascript same on body onload Event:

<script type="text/JavaScript">
function Refresh(time)
{
setTimeout("location.reload(true);",time);
alert("Page Refresh after 2 seconds");
}
</script>

<body onload="Refresh(2000)">





Vineeth1311, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakhangarg on: 8/31/2009 [Member] [Moderator] Silver

Up
0
Down
Hi-

Write your alert Message on Body laod and Unload Event in Javascript..

Thanks & Regards
Lakhan Pal Garg
http://lakhangarg.blogspot.com/


Vineeth1311, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response