Show Date n Time in Status Bar Using Javascript

Chikul
Posted by Chikul under JavaScript category on | Views : 3161
<head runat="server">
<title>Show Date n Time in Status Bar Using Javascript</title>
<script language="JavaScript" type="text/javascript">

var timerID = null;
var timerRunning = false;

function startclock()
{
var vNow = new Date();
var vHr = vNow.getHours();
var vMin = vNow.getMinutes();
var vSec = vNow.getSeconds()
var vTimeValue = vNow.getDate() + "/" + vNow.getMonth()+1 + "/" + vNow.getUTCFullYear()+ " "
vTimeValue += "" + ((vHr >12) ? vHr -12 :vHr)
vTimeValue += ((vMin < 10) ? ":0" : ":") + vMin
vTimeValue += ((vSec < 10) ? ":0" : ":") + vSec
vTimeValue += (vHr >= 12) ? " P.M." : " A.M."
window.status = vTimeValue;
timerID = setTimeout("startclock()",1000);
timerRunning = true;
}

</script>
</head>
<body onload="startclock()">
</body>

Comments or Responses

Login to post response