Categories:

Home / Free JavaScripts / Clocks, Calenders, And Timers / Here

Cut & Paste JavaScript Image Clock

Credit: JavaScript Kit

Description: This is a compact JavaScript image clock that's updated live every second. It comes with a default image pack for the interface, though you can easily specify you own "digits" images instead inside the script.

Example:

Directions

Step 1: Insert the below into the <HEAD> section of your page:

=13) sections[0]=sections[0]-12+"" for (var i=0; i'+'' else sections[i]=''+'' } return sections[0]+''+sections[1]+''+sections[2] } imageclock.display=function(){ var clockinstance=this this.spanid="clockspan"+(imageclock.instances++) document.write('') this.update() setInterval(function(){clockinstance.update()}, 1000) } imageclock.display.prototype.update=function(){ var dateobj=new Date() var currenttime=dateobj.getHours()+":"+dateobj.getMinutes()+":"+dateobj.getSeconds() //create time string var currenttimeHTML=imageclock.imageHTML(currenttime)+'' document.getElementById(this.spanid).innerHTML=currenttimeHTML }

Step 2: Then, to display the clock, call this function where you wish the clock to be shown:

Step 3: But wait, don't forget the images! Download the image pack below and upload the images inside to the same directory as your webpage:

You can modify the path to the images by configuring it near the top of the script of Step 1.


CSS Library | JavaScript & DHTML Menus
JavaScript Tools:
Site Info


CopyRight (c) 2018 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info