Automatically opens a small popup window and closes it after a specified time. Great for displaying important messages without forcing users to close multiple windows!
How to install this script:
THREE STEPS TO INSTALL AUTO POPUP WINDOW:
1. Copy the coding into the HEAD of your HTML document 2. Add the onLoad event handler into the BODY tag 3. Put the last coding into the BODY of your HTML document
STEP ONE: Paste this code into the HEAD of your HTML document
<HEAD>
<SCRIPT LANGUAGE="JavaScript"> <!-- Original: Rick Johnson (frj11@ev1.net) --> <!-- Web Site: http://rickjohnson.tripod.com -->
<!-- Begin function popupWin() { text = "<html>\n<head>\n<title>Pop Window</title>\n<body>\n"; text += "<center>\n<br>"; text += "<a href='http://javascript.internet.com/new' target='_blank'><h2>New JavaScripts</h2></a>"; text += "</center>\n</body>\n</html>\n"; setTimeout('windowProp(text)', 3000); // delay 3 seconds before opening } function windowProp(text) { newWindow = window.open('','newWin','width=300,height=100'); newWindow.document.write(text); setTimeout('closeWin(newWindow)', 5000); // delay 5 seconds before closing } function closeWin(newWindow) { newWindow.close(); // close small window and depart } // End --> </script></HEAD>
STEP TWO: Insert the onLoad event handler into your BODY tag
<BODY onLoad="popupWin()">
STEP THREE: Copy this code into the BODY of your HTML document
<center>This demo will open a small popup window 3 seconds after the page is loaded and close the window after it has been open for 5 seconds. </center>
Copyright 2006 WebSiteTrax - Hosted by WebSiteTrax.com