I have this code in javascript to show time in div and update it:
if (!document.all)
return
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
var dn="AM"
if (hours>12){
dn="PM"
hours=hours-12
}
if (hours==0)
hours=12
if (minutes<=9)
minutes="0"+minutes
if (seconds<=9)
seconds="0"+seconds
var ctime=hours+":"+minutes+":"+seconds
$("#c").text(ctime);
setTimeout("show2()",1000)
}
window.onload=show2
and I have this div :
<div id=""c></div>
in IE every thing is ok but when I try it in Firefox, it’s not working.
I also tried to use
c.innerHTML=ctime
and it’s not working.
What is the right way to do it on both IE and Firefox?
Thanks
it’s the first line
since .all property exists on Explorer and Opera only.
You are preventing other browser to continue code execution