Do you want to show Date and Time in status bar using Javascript? Or If you want to display Date and Time in status bar having MM/DD/YYY hh:mm:ss AM/PM format, copy below code in your page.
<head id="Head1" runat="server">
<title>Date and Time (MM/DD/YYYY hh:mm:ss AM/PM) in Status Bar Using Javascript</title>
<script language="JavaScript" type="text/javascript">
var timerID = null;
var timerRunning = false;
function showDateAndTime()
{
var vNow = new Date();
var vHr = vNow.getHours();
var vMin = vNow.getMinutes();
var vSec = vNow.getSeconds()
var vTime = vNow.getMonth()+1 + "/" + vNow.getDate() + "/" + vNow.getUTCFullYear()+ " "
vTime += "" + ((vHr >12) ? vHr -12 :vHr)
vTime += ((vMin < 10) ? ":0" : ":") + vMin
vTime += ((vSec < 10) ? ":0" : ":") + vSec
vTime += (vHr >= 12) ? " PM" : " AM"
window.status = vTime;
timerID = setTimeout("showDateAndTime()",1000);
timerRunning = true;
}
</script>
</head>
<body onload="showDateAndTime()">
</body>
No comments:
Post a Comment