Webocreation

Wednesday, February 3, 2010

show time with javascripts code

<html>
<head>
<script type="text/javascript">
function JSclock()
{

var time=new Date();
var hour=time.getHours();

var min=time.getMinutes();
var second=time.getSeconds();
var temp=""+((hour>12) ? eval(hour-12) : hour);
temp+=((min<10) ? ":0" : " : ") + min;
temp+=((second<10) ? ":0" : " :")+second;
temp+=((hour>=12) ? "pm" : "am");
document.getElementById("currentTime").innerHTML=temp;
setTimeout("JSclock()",1000);
}
</script>
</head>
<body onload="JSclock()">
<span id="currentTime"></span>
</body>
</html>

show time with javascripts code, javascript code, time giving javascript code

No comments:

Post a Comment