To create a pop-up window which closes after a certain amount of time. Notice where it says closetime=20. Also notice delay =2. Alter those variables to your own taste. NOtice where it says url="popup.htm". popup.htm is my document that goes in the window.You will need to create the document that goes in the popup window.You can see it in action at http://digital.mica.edu/eschoole/color/.
If you would like to try other pop-ups and variants go to http://javascriptsource.com.
Place the following inbetween the head tags:
<!-- Begin
closetime = 20; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds
function Start(URL, WIDTH, HEIGHT) {
windowprops = "left=50,top=50,width=" + WIDTH + ",height="
+ HEIGHT;
preview = window.open(URL, "preview", windowprops);
if (closetime) setTimeout("preview.close();", closetime*1000);
}
function doPopup() {
url = "popup.htm";
width = 267; // width of window in pixels
height = 250; // height of window in pixels
delay =2; // time in seconds before popup opens
timer = setTimeout("Start(url, width, height)", delay*1000);
}
// End -->
then in the body tag do the following:
as an attribute for the body tag use the "onload dopopup". Here is an example of it in my tag.
<body bgcolor="#990000" text="#000000" onLoad="doPopup()">