## New Window - Close on Timer 1

What you just saw is an example a new window when the page loads which then gets closed by a timer. You can specify the time that the window stays open. There are many different ways that you can open the window look at the examples below this 1 of 5 of them.

<!--Put this in your <head></head> tag. Change YOUR PAGE NAME and the number "3" if you want the window to stay open longer. --> <script> function winopen(){ win = window.open("YOUR PAGE NAME", "newWin", "toolbar=yes,location=yes,directories=no,status=no, menubar=yes,scrollbars=yes,resizable=no,copyhistory=yes,width=400,height=260") startTime() } function startTime(){ var time= new Date(); hours= time.getHours(); mins= time.getMinutes(); secs= time.getSeconds(); closeTime=hours*3600+mins*60+secs; closeTime+=3; // Amount of time that the window stays open in seconds Timer(); } function Timer(){ var time= new Date(); hours= time.getHours(); mins= time.getMinutes(); secs= time.getSeconds(); curTime=hours*3600+mins*60+secs if (curTime>=closeTime){ if (win.closed == false){ win.close()}} else{ window.setTimeout("Timer()",1000)} } </script> <!--Now put this inside your <body> tag to open when a new page opens like in the example when youloaded this page --> onLoad="winopen()"

Reload Page To See Example Of This Script Above
`
`