kriti.kulkarni
Posts : 2 Blades : 10178 Join date : 2010-06-15
| Subject: Stop Watch In Javascript Wed 16 Jun 2010 - 10:21 | |
| Can you please provide me the code for placing a STOP WATCH in my webpage .
I am running a survey and need a stop watch urgently..
Krits India | |
|
anjana
Posts : 7 Blades : 9972 Join date : 2010-11-29 Age : 37 Location : India
| |
Admin Admin
Posts : 30 Blades : 11856 Join date : 2008-04-15 Age : 40 Location : Cyber World.
| Subject: Sorry Wed 8 Dec 2010 - 15:24 | |
| Actually this question was not answered as the user was given the link to download this script... Anyways we are sorry for this stupidity.. Here is the script.. Insert it between where ever you wanna display the watch.. - Code:
-
<SCRIPT LANGUAGE="JavaScript"> /* [You must be registered and logged in to see this link.]*/ 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; } } window.onload=display </SCRIPT> <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> | |
|
banarasi.babu
Posts : 6 Blades : 9886 Join date : 2010-11-29 Location : india
| Subject: very nice script Thu 9 Dec 2010 - 12:32 | |
| i used this script its really nice and simple...But how can i change the button colors and text box colors...can i do that?? Banarsi Babu | |
|
Sponsored content
| Subject: Re: Stop Watch In Javascript | |
| |
|