I cant figure out why my redirect is off by about 1 sec from my countdown... I have both scripts in the body of the page... this seems to help because I tried to have the redirect in the header and it was off from the countdown by like 2-3 sec...
here is the redirect code (this is in a php file)
Code:print "<script type=\"text/javascript\">"."\n"; print "window.onload=WindowLoad;"."\n"; print "function WindowLoad(event)"."\n"; print "{"."\n"; print "setTimeout(\"location = 'EquipReport.php';\", 20000);"."\n"; print "}"."\n"; print "</script>"."\n";
here is the countdown code
anyone know why it is off?Code:print "<form name='counter'><input type='text' size='6' name='d2' disabled style='border:0px; bgcolor:#FFFFFF;'></form> "."\n"; print "<script>"."\n"; print "<!--"."\n"; print "//"."\n"; print " var milisec=0"."\n"; print " var seconds=20"."\n"; print " document.counter.d2.value='20'"."\n"; print " function display(){"."\n"; print " if (milisec<=0){"."\n"; print " milisec=9"."\n"; print " seconds-=1"."\n"; print " }"."\n"; print " if (seconds<=-1){"."\n"; print " milisec=0"."\n"; print " seconds+=1"."\n"; print " }"."\n"; print " else"."\n"; print " milisec-=1"."\n"; print " document.counter.d2.value=seconds+\".\"+milisec"."\n"; print " setTimeout(\"display()\",100)"."\n"; print "} "."\n"; print "display()"."\n"; print "--> "."\n"; print "</script>"."\n";



Reply With Quote

Bookmarks