Domino Code Fragment

Code Name*
Clock in Status Bar
Date*
01/14/1999
Source (or email address if you prefer)*
Lotus
IP address:.
Description*
Displays a live clock in the user's browser status bar.
Type*
JavaScript
Categories*
User Interface (Web), Website Tools
Implementation:
None (plug and play)
Required Client:
JavaScript 1.0
Server:
Limitations:
Comments:
Paste into a computed text field
Files/Graphics attachments (if applicable): Code:
<BODY onLoad='startclock()'>
<A NAME='top'>
<script language='JavaScript'>
var timerID = null;
var timerRunning = false;
function stopclock (){
if(timerRunning)
clearTimeout(timerID);
timerRunning = false;
}
function startclock () {
stopclock();
showtime();
}
function showtime () {
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds()
var timeValue = ((hours >12) ? hours -12 :hours)
timeValue += ((minutes < 10) ? ':0' : ':\') + minutes;
timeValue += ((seconds < 10) ? ':0' : ':\') + seconds;
timeValue += (hours >= 12) ? ' PM' :' AM';
window.status = timeValue;
timerID = setTimeout('showtime()',1000);
timerRunning = true;
}
</script>