Search for Free 150,000+ Essays

Find more results for this search now!
CLICK the BUTTON to the RIGHT!

Need a Brand New Custom Essay Now?  click here

Visual Clock Display and Simple Date Script Source Code

Visual Clock Display Java Script Source Code

This script shows a real-time digital clock using your own images. Just be sure and replace your image names or name your images correctly in the code below

Copy the following code into your HEAD tags.

<script language="Javascript">
function Go() {
nu = new Date();
hr = nu.getHours();
min = nu.getMinutes();
sec = nu.getSeconds();
ext = ".gif";
if(hr<="9"){hr = "0" + hr;} else {hr = "" + hr;}
if(min<="9"){min = "0" + min;} else {min = "" + min;}
if(sec<="9"){sec = "0" + sec;} else {sec = "" + sec;}
hrc = hr.substring(0,1);
hrd = hr.substring(1,2);
document.images.hra.src = "" + hrc + ext;
document.images.hrb.src = "" + hrd + ext;
minc = min.substring(0,1);
mind = min.substring(1,2);
document.images.mina.src = "" + minc + ext;
document.images.minb.src = "" + mind + ext;
secc = sec.substring(0,1);
secd = sec.substring(1,2);
document.images.seca.src = "" + secc + ext;
document.images.secb.src = "" + secd + ext;
setTimeout("Go()", 20);
}
</script>

Copy the following code into your BODY tag.
<body onLoad="Go();">

Copy the following code into the BODY of your html page.

<img src="" name=hra><img src="" name=hrb><img src="y.gif"><img src="" name=mina><img src="" name=minb><img src="y.gif"><img src="" name=seca><img src="" name=secb>

And that's it. You should see your image based clock working in real-time. If you have any problems go back and make sure you named all your files correctly.

Now for the "Date" script. Just copy the following into the BODY of your html page.

<script language="Javascript">
<!--
/*
Today's date script
Visit java-scripts.net or
http://wsabstract.com for this script
*/

var dayName = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday")

var monName = new Array ("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December")

var now = new Date

document.write("Today is " + dayName[now.getDay()] + ", " + monName[now.getMonth()] + " "+now.getDate() +".")

//-->
</script>

Sign In Now to Read Entire Essay

Not a Member?   Create Your FREE Account »

Comments / Reviews

read full essay >>

Already a Member?   Login Now >

This essay and THOUSANDS of
other essays are FREE at eCheat.

Uploaded by:  

Date:  

Category:   Java

Length:   1 pages (307 words)

Views:   5978

Report this Essay Save Essay
Professionally written essays on this topic:

Visual Clock Display and Simple Date Script Source Code

View more professionally written essays on this topic »