mcmuney Posted August 19, 2009 Share Posted August 19, 2009 Is there a way to modify this script to work outside of a form? Working Link <form name="counter"><input type="text" size="8" name="d2"></form> <script> <!-- // var milisec=0 var seconds=30 document.counter.d2.value='30' function display(){ if (milisec<=0){ milisec=9 seconds-=1 } if (seconds<=-1){ milisec=0 seconds+=1 } else milisec-=1 document.counter.d2.value=seconds+"."+milisec setTimeout("display()",100) } display() --> </script> Link to comment https://forums.phpfreaks.com/topic/170922-timer-countdown/ Share on other sites More sharing options...
ldb358 Posted August 19, 2009 Share Posted August 19, 2009 i thnk this shoud work: var time = document.getElementById("yourElement"); time.innerHtml = 30; //then later time.innerHtml = seconds+"."+milisec you can use this is a variety of elements linke div, span, ect. just put the elements id where it says yourElement Link to comment https://forums.phpfreaks.com/topic/170922-timer-countdown/#findComment-902087 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.