I am creating this countdown clock, that will later be turned into a slot machine, where my php script will output to the javascript the values to countdown to.
all seems to work, just a small hickup. for some reason the middle value, display2() countsdown to 0, then jumps up to its actual value
ex: [url]http://cyber-wars.com/time.html
code is below
[CODE]
<html>
<head></head>
<body>
<table border=1>
<tr><td id=”d1″ STYLE=”font-size: 48″></td><td id=”d2″ STYLE=”font-size: 48″></td><td id=”d3″ STYLE=”font-size: 48″></td></tr></table>
<script>
<!–
//
var milisec=”50″;
var milisec2=”65″;
var milisec3=”77″;
function display(){
if (milisec<=9){
//make sure to change both variables to actual value
milisec=”9″;
milishort=”9″;
}
else
mililength = milisec.toString();
if(mililength.length>1 && milisec !=9){
milishort = mililength.substring(1);
}
milisec=milisec-1;
document.getElementById(‘d1’).innerHTML=milishort;
setTimeout(“display()”,75);
}
function display2(){
if (milisec2<=2){
//make sure to change both variables to actual value
milisec2=”3″;
milishort2=”3″;
}
else
mililength2 = milisec2.toString();
if(mililength2.length>1 && milisec2 !=3){
milishort2 = mililength2.substring(1);
}
milisec2=milisec2-1;
document.getElementById(‘d2’).innerHTML=milishort2;
setTimeout(“display2()”,75);
}
function display3(){
if (milisec3<=7){
//make sure to change both variables to actual value
milisec3=”7″;
milishort3=”7″;
}
else
mililength3 = milisec3.toString();
if(mililength3.length>1 && milisec3 !=7){
milishort3 = mililength3.substring(1);
}
milisec3=milisec3-1;
document.getElementById(‘d3’).innerHTML=milishort3;
setTimeout(“display3()”,75);
}
display();
display2();
display3();
–>
</script>
</body>
</html>
any help would be appreciated, also i know i suck at JS, if anyone could help clean this up, i would be grateful
thanks,
PaPPy