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!

can someone please tell me why the

Status
Not open for further replies.

altaratz

ISP
Apr 15, 2001
73
0
0
US
can someone please tell me why the below function won't return to the function "countdown", after it reaches "reset" - I'm pulling my hair out (javascript newbie)

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


<script>

var id;


function countdown()

{
jj.kk.value--;
if ( jj.kk.value == 0 )
{
self.clearInterval(id);
gogogo();


}


}


function reset()

{
jj.kk.value = jj.kk.value+10;
countdown();
}


function gogogo()
{
parent.middle.location.replace(' reset();

}

id = self.setInterval('countdown();',1000);

</script>
 
i answered a post very much like this with the following code:

<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.location.replace(&quot;}

-->
</script>


</body>
</html>

As you can see the page has a counter in the top left corner that counts down from 5 to 0 then sets the window location to the yahoo site the counter is reset when the user moves the mouse, but you can reset the page by attaching the 'setkk()' function to any(?) event.
I hope that you will be able to change it to fits your needs more precisely...
Rhys
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top