Sunday, August 24, 2008

Show the current time like a clock on the page using javascript in 3 steps!

this script uses the Javascript Date object and the SetTimeout method to show the current time on the web page.
Get the clock to show up on your site in just simple copy and paste. its that simple!

1 - Main Script:

Copy the following code into the "head" section of your page.

2 - Change the body tag:

Add an onLoad handler to the body tag of your page to look something like this.

3 - Add the "id" attribute:

last but not the least add an id to the tag where you want the date to be displayed. The html markup should look something like this
And Viola! you are done.

No comments: