<html><head><title>无标题文档</title>
<style>
form{ font-size:22px;}
input{ font-size:24px;
color:#FF0000;
width:180;
height:40;
}
</style>
<script language="JavaScript">
function aClock(){
var now=new Date();
var hour=now.getHours();
var min==now.getMinutes();
var sec=now.getSeconds();
var timeStr=""+hour;
timeStr+=((min<10)?":0":":")+min;
timeStr+=((sec<10)?":0":":")+sec;
timeStr+=(hour<12)?"P.M.":"A.M.";
document.clock_form.clock_text.value=timeStr;
clockId=setTimeout("aClock()",1000);
}
</script>
</head>
<body onLoad="aClock()"><br><br><br>
<form name="clock_form">
当前时间是:
<input type="text" name="clock_text" value="20:15:02 P.M.">
</form>
</body>
</html>
第14行 你写了两个等号
var min==now.getMinutes();
改成一个
var min=now.getMinutes();
应该没有问题
<html><head><title>无标题文档</title>
<style>
form{ font-size:22px;}
input{ font-size:24px;
color:#FF0000;
width:180;
height:40;
}
</style>
<script language="JavaScript">
function aClock(){
var now=new Date();
var hour=now.getHours();
var min=now.getMinutes();
var sec=now.getSeconds();
var timeStr=""+hour;
timeStr+=((min<10)?":0":":")+min;
timeStr+=((sec<10)?":0":":")+sec;
timeStr+=(hour<12)?"A.M.":"P.M.";
document.clock_form.clock_text.value=timeStr;
clockId=setTimeout("aClock()",1000);
}
</script>
</head>
<body onLoad="aClock()"><br><br><br>
<form name="clock_form">
当前时间是:
<input type="text" name="clock_text" value="20:15:02 P.M.">
</form>
</body>
</html>
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息