What is the code to close a window?
Question: What is the code to close a window?
When you use a popup window, what is the code to close that window so people don't have to hit the "x" in the corner?
Answer:
Actually, there are two ways to go with this question. If you want a button that they have to click in order to close the popup window, use the following code:
<form><input type=button value="Close Window" onClick="window.close();"> </form>
If you want the popup window to close automatically after a predetermined time, add the onLoad command in the <body> tag of the html page in the popup window as follows:
<BODY onLoad="setTimeout(window.close, 5000)">
Increase the number 5000 to 20000 or higher depending on the amount of time it will take to read the content of that page.
|