Self Closing Pop Up window

Self Closing Pop Up window.

This is the code for a self closing pop up window.  The time is set to 5 seconds.  The variable howLong is set to 5000 which is in milliseconds.  If you wanted 6 seconds it would be set to 6000 and so on.  This webpage can be called from another page with a new window function.  There is very little code involved, you don't even need what is between the TABLE tags.  All you need is the script between the HEAD tags and the ONLOAD event in the BODY tag.

<HTML>
<HEAD>
   <TITLE>Self Close</TITLE>
 
   <SCRIPT>
   var howLong = 5000;
   t = null;
   function closeMe(){
   t = setTimeout("self.close()",howLong);
   }
   </SCRIPT>
</HEAD>

<BODY text="#990000" onload="closeMe();self.focus()">

<TABLE align="center" width="300">
<TR>
   <TD align="center">
         <P align="center"><B>This window will self destruct in 5 seconds!</B>
   </TD>
</TR>
</TABLE>  

</BODY>

</HTML>

Comments

Be the first to write a comment

You must me logged in to write a comment.