HTML : Open a new windows for x number of seconds

 I had a requirement to open a new window for a certain amount of time then close it again, this was to be used for a "welcome message" that needed to remain persistant on the screen.

I did this to get it working, for this the following code goes in the "head" HTML tag:

<script type="text/javascript">

function allOn(){

var myWindow ='','1366002941508','width=1024,height=768,left=5,top=3')

setTimeout(function() { myWindow.close();}, 5000);



Then when you need to call this function you need to add this as a link in the BODY:

<input type=submit value="Accept these conditions" onclick="allOn();" />

In this example this would open a new windows for 5 seconds and close it, sometimes java can be cool, this is one of those times.

If you would like it to scale the the size of the window you have open before then chnage this:


to this

'"width=" + screen.width + ",height=" + screen.height,left=5,top=3'

Previous Post Next Post

Ω†Ω…ΩˆΨ°Ψ¬ Ψ§Ω„Ψ§ΨͺΨ΅Ψ§Ω„