JavaScript Count down timer

Is a dynamic computer programming language.[5] It is most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.[5] It is also used in server-side network programming with runtime environments such as Node.js, game development and the creation of desktop and mobile applications.
Post Reply
dzcadii
Posts: 94
Joined: Sun Mar 01, 2015 4:36 am

JavaScript Count down timer

Post by dzcadii » Sun Mar 01, 2015 11:00 pm

Simple JavaScript count down timer
display() calls the function

Code: Select all

<script language="javascript"> 
<!-- 
// 
 var milisec=0 
 var seconds="60"//Change to how many seconds to count down
 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>

Post Reply