<html> 
<head> 
<script type="text/javascript"> 
var theTime = "";
function startTime()
{
theTime = window.setInterval("stTime()",1000);
}

function stopTime()
{
window.clearInterval(theTime);
}

function stTime()
{
today = new Date();
with(today);
{
document.form1.timer.value = getHours()+" 点 "+getMinutes()+" 分 "+getSeconds()+" 秒 ";
}
}</script> 
</head> 
<body onLoad="startTime();"> 
<form name="form1">
<h2>现在时间:</h2>
<input name="timer">
<h2>点击开始计时:</h2>
<input type="button" value="点击开始计时" onClick="startTime()">
<h2>点击停止计时:</h2>
<input type="button" value="点击停止计时" onClick="stopTime()">
</form>
</body> 
</html> 

解决方案 »

  1.   

    document.form1.timer.value = getHours()+" 点 "+getMinutes()+" 分 "+getSeconds()+" 秒 "
    难道是传说中的全角分号?
      

  2.   

    document.form1.timer.value = today.getHours()+" 点 "+today.getMinutes()+" 分 "+today.getSeconds()+" 秒 ";
      

  3.   

    document.form1.timer.value = getHours()+" 点 "+getMinutes()+" 分 "+getSeconds()+" 秒 ";
    ------------------------>
    document.form1.timer.value = getHours()+" 点 "+getMinutes()+" 分 "+getSeconds()+" 秒 ";
      

  4.   

    找到原因了  
    with(today);
    我加了个分号 迷糊结账