Popup Windows4. Timed Window Close |
|
Join the DiscussionMore of this FeatureIn the last tutorial we saw how we could set up a new window to popunder when it was first created and then popup after a set time period. We also saw in the first tutorial how we could add a close link to the popup window to allow our visitors to close the window by selecting a link within the window. We can easily combine these two pieces of code to make the window close itself automatically after a certain time has elapsed. The code that we would use to do this is as follows if placed in the code in the main window:
setTimeout('TheNewWin.close();',30000);
or like this if added to the popup/popunder window itself:
setTimeout('self.close();',30000);
In both examples I have used 30 seconds (30000 milliseconds) as the delay before closing. You can easily change this to whatever amount of time (in thousandths of a second) that you require. |

