if/else number of seconds
Posted: Sat Mar 19, 2005 5:54 pm
I have a javascript that looks like this
then to make the function work my HTML looks like this
This displays a countdown from 20 to 0. What I would like to do is after the time is up, display a link to the next page. Which I can do fine. But I'd like to do a check to see if seconds > 0 = "You're moving to fast" ELSE process next page
I don't know how to store the number of seconds in a variable to do this?
Code: Select all
<HTML>
<HEAD>
<TITLE>title here</TITLE>
<script>
<!--
var timeout = 1000; var num = 0; var na = "e;00"e;; var secs = 20;
function go(){ na = secs; if (secs < 10) { na= "e;0"e; + na; }
document.getElementById("e;countDownText"e;).innerHTML = na;
secs = secs - 1
if (secs+1 < 1) {
document.getElementById("e;countDownText"e;).innerHTML = "e;Go"e;;}
if (secs+1 > 0) { setTimeout("e;go();"e;,timeout); }
}
-->
</script>
ї/head]Code: Select all
<BODY onLoad="e;go();"e;BGCOLOR="e;#666666"e; LEFTMARGIN="e;0"e; TOPMARGIN="e;0"e;>
<div id="e;countDownText"e;></div>I don't know how to store the number of seconds in a variable to do this?