function clock() {     
if (!document.layers && !document.all && !document.getElementById) return;     
var digital = new Date();     
var hours = digital.getHours();     
var minutes = digital.getMinutes();     
var seconds = digital.getSeconds();     
var ampm = "am";     
if (hours > 11) ampm = "pm";     
if (hours > 12) hours = hours - 12;     
if (hours == 0) hours = 12;     
if (minutes <= 9) minutes = "0" + minutes;     
if (seconds <= 9) seconds = "0" + seconds;     
dispTime = hours + ":" + minutes + ":" + seconds + ampm + " ";     
//     
// Note that I changed the order of checking the different methods,     
// as in 99% of cases it will work.     
if (document.getElementById) {       
document.getElementById('clktime').innerHTML = dispTime;     
} else if (document.layers) {       
document.layers.clktime.document.write(dispTime);       
document.layers.clktime.document.close();     
} else if (document.all)       
document.all['clktime'].innerHTML = dispTime;     
setTimeout("clock()", 1000);   
} 