This is a discussion on Stop watch that can be paused and unpaused. within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all... Can anyone tell me how can i stop watch that can be paused and unpaused. Thanks in advance......
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| HI take a look <!-- THREE STEPS TO INSTALL STOPWATCH: 1. Paste the coding into the HEAD of your HTML document 2. Copy the onLoad event handler into the BODY tag 3. Add the last code into the BODY of your HTML document --> <!-- STEP ONE: Copy this code into the HEAD of your HTML document --> <HEAD> <SCRIPT LANGUAGE="JavaScript"> <!-- Begin var ms = 0; var state = 0; function startstop() { if (state == 0) { state = 1; then = new Date(); then.setTime(then.getTime() - ms); } else { state = 0; now = new Date(); ms = now.getTime() - then.getTime(); document.stpw.time.value = ms; } } function swreset() { state = 0; ms = 0; document.stpw.time.value = ms; } function display() { setTimeout("display();", 50); if (state == 1) {now = new Date(); ms = now.getTime() - then.getTime(); document.stpw.time.value = ms; } } // End --> </SCRIPT> <!-- STEP TWO: Add this onLoad event handler into the BODY tag --> <BODY onLoad="display()"> <!-- STEP THREE: Put this code into the BODY of your HTML document --> <CENTER> <FORM NAME="stpw"> Time: <INPUT TYPE="text" Name="time"> <INPUT TYPE="BUTTON" Name="ssbutton" VALUE="Start/Stop" onClick="startstop()"> <INPUT TYPE="BUTTON" NAME="reset" VALUE="Reset" onClick="swreset()"> </FORM> </CENTER> thanks |
| |||
| Paste the coding into the HEAD of your HTML document. |
| |||
| thanks for the code Miacoda not you limon, where is your code. |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Stop the Refreshing | Kirubhananth | HTML, CSS and Javascript Coding Techniques | 2 | 03-19-2008 09:42 PM |
| How to watch a file using C#? | S.Vinothkumar | C# Programming | 4 | 09-26-2007 12:30 AM |
| How to watch a file whenever we change or modify the content using c#? | mobilegeek | C# Programming | 5 | 08-20-2007 07:38 AM |
| How do we stop the ajax request? | raj | PHP Programming | 2 | 07-22-2007 10:39 PM |
| when to stop testing? | vadivelanvaidyanathan | Software Testing | 0 | 04-11-2007 01:59 AM |