Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to close a Window after 5 secons...

Status
Not open for further replies.

fux

Programmer
May 9, 2001
3
0
0
PL
I have to send Form... then new window is loading and it should close itself after 5 seconds...
THX a lot
 
Here is a bit of code that will help.
this page consists of a counter that counts down from 5 to 0 then closes the window. There is some code that resets the counter if you move the mouse (you will probably want to remove this, but i though i'd leave it in to show you what can be done).

HTH

Rhys

<html>
<head>
<title>Untitled</title>
</head>

<body onLoad=&quot;fnStartInterval()&quot; onmousemove=&quot;setkk()&quot;>

<form name=jj>
<input type=text name=kk value=5 size=4 >
</form>

<script language=&quot;JavaScript&quot; type=&quot;text/javascript&quot;>
<!--

function setkk()
{
document.jj.kk.setAttribute(&quot;value&quot;,&quot;5&quot;)
}

function fnStartInterval(){
window.setInterval(&quot;countdown()&quot;,1000)
}

function countdown()
{
if (document.jj.kk.value>0)
{
document.jj.kk.setAttribute(&quot;value&quot;, document.jj.kk.value -1)}
else
{gogogo()}

}

function gogogo()
{
window.close()
}

-->
</script>


</body>
</html>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top