Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within HTML Pages with CSS and JavaScript
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
HTML Pages with CSS and JavaScript
JavaScript timer issue
vainu siva
Greenhorn
Posts: 6
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
hi...i've done a timer program...using today'date....but i need to start the timer like 00:00:00....wat modifications shoul i do
function startTime() { var today=new Date(); var h=today.getHours(); var m=today.getMinutes(); var s=today.getSeconds(); h=checkTime(h); m=checkTime(m); s=checkTime(s); document.getElementById('txt').innerHTML=h+":"+m+":"+s; t=setTimeout('startTime()',0); } function checkTime(i) { if (i<10) { i="0" + i; } return i; } function checkTime(a) { if (a<10) { a="0" + a; } return a; } function checkTime(w) { if (w<10) { w="0" + w; } return w; }
[ December 26, 2007: Message edited by: Bear Bibeault ]
Eric Pascarello
author
Posts: 15385
6
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Set the start time into a variable. Subtract the current time from the start time. That gives you milliseconds.
Eric
Bear Bibeault
Sheriff
Posts: 67746
173
I like...
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Please be sure to take the time to compose descriptive subjects for your posts;
read this
for more information.
I have adjusted the subject of this post for you.
[
Asking smart questions
] [
About Bear
] [
Books by Bear
]
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
how do I access the onKeyPress value?
Unix OS on Windows Vista ?
How to implement Request Time Out
Java help!!!!
Javascript based refresh
More...