<script>
function tm()
{
var td=new Date()
var mm=td.getSeconds()
document.all.mxh.innerText=mm
setTimeout("tm()",1000)
}</script>
<body onload="tm()">
<div id=mxh></div>
function tm()
{
var td=new Date()
var mm=td.getSeconds()
document.all.mxh.innerText=mm
setTimeout("tm()",1000)
}</script>
<body onload="tm()">
<div id=mxh></div>
<!--
var today=new Date();
var isnMonth = new
Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDay = new
Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
function showbysecond()
{
Year=today.getYear();
Date=today.getDate();
var hour=today.getHours();
var minute=today.getMinutes();
var second=today.getSeconds();
if (hour>12)
{timevalue=hour-12;}
else
{timevalue=hour;}
if (minute<10)
{timevalue+=":0";}
else
{timevalue+=":";}
timevalue+=minute;
timevalue+=":"+second;
if (hour>12)
{timevalue+="pm";}
else
{timevalue+="am";}
myp.innerHTML="<FONT size=2 COLOR=blue>"+"now:"+Year+"年"+isnMonth[today.getMonth()]+today.getDate()+"日 "+timevalue+" "+isnDay[today.getDay()];
setTimeout("showbysecond()",1000);
}
<body onload="showbysecond()">
<p id="myp"></p>
<script language="Javascript">
var isnMonth = new
Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDay = new
Array("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
function showbysecond()
{
var today=new Date();
Year=today.getYear();
//Date1=today.getDate();
var hour=today.getHours();
var minute=today.getMinutes();
var second=today.getSeconds();
if (hour>12)
{timevalue=hour-12;}
else
{timevalue=hour;}
if (minute<10)
{timevalue+=":0";}
else
{timevalue+=":";}
timevalue+=minute;
timevalue+=":"+second;
if (hour>12)
{timevalue+="pm";}
else
{timevalue+="am";}
myp.innerHTML="<FONT size=2 COLOR=blue>"+"now:"+Year+"年"+isnMonth[today.getMonth()]+today.getDate()+"日 "+timevalue+" "+isnDay[today.getDay()] + "</font>";
setTimeout("showbysecond()",1000);
}
</script>
<body onload="showbysecond()">
<p id="myp"></p>
错误1:
var today位置不对,不能按时刷新
错误2:Date不能为变量