[求助]js,动态时间问题~~
刚学JS,高手看下这段动态时间代码哪里出问题了? setInterval()没起到作用。<html
<head>
<title>JStest</title>
<script language="javascript">
var loops = setInterval("showTime()",1000)
function showTime(){
var nowTime = new Date();
var strHours,strTemp,strTime;
with(nowTime){
if (getHours()>12){
strHours = getHours() - 12;
strTemp = "PM";
} else {
strHours = getHours();
strTemp = "AM";
}
strTime =getYear()+"年"+getMonth()+"月"+getDate()+"日 "+strHours+":"+getMinutes()+":"+getSeconds()+" "+strTemp;
}
document.write(strTime)
}
</script>
</head>
<body>
</body>