You are on page 1of 2

DIGITAL CLOCK and DATE SCRIPT Copy the script by highlighting the script and then using the

"Edit" "Copy" commands at the top of your browser. Or, copy the page by using the "File" "Save as" command on the top of your browser. Follow all directions exactly. To return to the Bells and Whistles page, use your browser back button. This is a two part installation ----------------------------------------------------Part One Copy the following to your <head> tag : <script language="JavaScript"> <!-- Hide from older browsers var timerID = null var timerRunning = false function MakeArray(size) { this.length = size; for(var i = 1; i <= size; i++) { this[i] = ""; } return this; } function stopclock (){ if(timerRunning) clearTimeout(timerID); timerRunning = false } function showtime () { var now = new Date(); var year = now.getYear(); var month = now.getMonth() + 1; var date = now.getDate(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds(); var day = now.getDay(); Day = new MakeArray(7); Day[0]="SUNDAY"; Day[1]="MONDAY"; Day[2]="TUESDAY"; Day[3]="WEDNESDAY"; Day[4]="THURSDAY"; Day[5]="FRIDAY"; Day[6]="SATURDAY"; var timeValue = ""; timeValue += (Day[day]) + " "; timeValue += ((month > 10) ? " 0" : timeValue += date + "-" + year + " timeValue += ((hours <= 12) ? hours timeValue += ((minutes < 10) ? ":0" timeValue += ((seconds < 10) ? ":0" timeValue += (hours < 12) ? " AM" :

" ") + month + "-"; "; : hours - 12); : ":") + minutes; : ":") + seconds; " PM";

document.bells.face.value = timeValue; timerID = setTimeout("showtime()",1000); timerRunning = true } function startclock () { stopclock(); showtime() } // End Hide --> </SCRIPT> ----------------------------------------------------Part Two Copy this script inside your body tag: onLoad="startclock();" ---------------------------------------------Part Three Copy this script to wherever on your page you wish the clock to appear: <center><FORM NAME='bells'> <INPUT TYPE=text NAME='face' size=35 value=''> </FORM></center> There is nothing to configure on this script. Insert the entire script wherever you wish to have the clock show on the document.

You might also like