IT Community - Software Programming, Web Development and Technical Support

How do I write a clock program in JavaScript?

This is a discussion on How do I write a clock program in JavaScript? within the HTML, CSS and Javascript Coding Techniques forums, part of the Web Development category; Hi all... How do I write a clock program in JavaScript? Thanks & Regards itbarota....


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > HTML, CSS and Javascript Coding Techniques

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 09-13-2007, 03:25 AM
itbarota itbarota is offline
D-Web Architect
 
Join Date: Jun 2007
Posts: 547
itbarota is on a distinguished road
Default How do I write a clock program in JavaScript?

Hi all...

How do I write a clock program in JavaScript?

Thanks & Regards
itbarota.
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 09-13-2007, 04:25 AM
Pvinothkumar Pvinothkumar is offline
D-Web Analyst
 
Join Date: Sep 2007
Posts: 237
Pvinothkumar is on a distinguished road
Default Re: How do I write a clock program in JavaScript?

Hi.......

A simple clock program would retrieve a new Date() every second (or, better yet, several times a second) and then display the time information from the Date() object. The following code displays a clock on the browser's status bar:

function sbClock() {
var DateString=(new Date()).toString();
self.status=DateString.substring(0,3+DateString.la stIndexOf(':'));
setTimeout("sbClock()",200);
}
sbClock();

Thanks......
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 10-12-2007, 10:55 PM
kingmaker kingmaker is offline
D-Web Genius
 
Join Date: Jun 2007
Posts: 882
kingmaker is on a distinguished road
Send a message via Yahoo to kingmaker
Default Re: How do I write a clock program in JavaScript?

<script language="javascript">
var dateform
speed=1000
len=28
tid = 0;

function dodate()
{
f.date.value=new Date();
tid=window.setTimeout("dodate()",speed);
}

function start(x) {
f=x
tid=window.setTimeout("dodate()",speed);
}

function cleartid() {
window.clearTimeout(tid);
}

// for some reason on some pages this crashes netscape
function Clock()
{
document.write('<FORM name=dateform><input name=date size=')
document.write(len)
document.write(' value="Clock: Requires Javascript"></FORM>')
start(document.dateform);
}
// end-->
</script>
__________________
The KINGMAKER
Makes Every Thing Possible

Stuffs (My Blog)
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
can we write a c program for a elctronics product? saravanan C and C++ Programming 4 10-23-2008 11:05 AM
Clock on a webpage that syncs with the Atomic clock. itbarota HTML, CSS and Javascript Coding Techniques 1 03-16-2008 08:33 PM
How do I write a file from JavaScript? itbarota HTML, CSS and Javascript Coding Techniques 5 10-26-2007 01:54 AM
How can I write Arabic characters in my Javascript? Pvinothkumar HTML, CSS and Javascript Coding Techniques 1 09-14-2007 12:44 AM
How to write Bluetooth Connection program in c# for Windows mobile 5.0 ? theone Windows Mobile 0 07-16-2007 12:16 AM


All times are GMT -7. The time now is 12:29 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0