New Technologies

  • Java
  • Javascript
  • DTML
  • Dot Net
  • ASP .Net
  • C# .Net
  • PHP
Your Ad Here
Showing posts with label Simple JavaScript Clock. Show all posts
Showing posts with label Simple JavaScript Clock. Show all posts

Sunday, June 29, 2008

Simple JavaScript Clock

<SCRIPT Language="JavaScript">

<!-- hide from old browsers

function jsClock(){

var time = new Date()

var hour = time.getHours()

var minute = time.getMinutes()

var second = time.getSeconds()

var temp = "" + ((hour > 12) ? hour - 12 : hour)

if(hour==0) temp = "12"

if(temp.length==1) temp = " " + temp

temp += ((minute < 10) ? ":0" : ":") + minute

temp += ((second < 10) ? ":0" : ":") + second

temp += (hour >= 12) ? " PM" : " AM"

document.clockForm.digits.value = temp

id = setTimeout("jsClock()",1000)

}

//-->

</SCRIPT>

<BODY ONLOAD="jsClock()">

<FORM NAME="clockForm">

<FONT face="Courier New,Courier" size=3><B>

<INPUT TYPE="text" NAME="digits" SIZE=11 VALUE="Loading"></B>

</FONT>

</FORM>

Your Ad Here