<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>定时器</title>
<script type="text/javascript">
var attime;
setInterval(clock,1000)
function clock(){
var time=new Date();
var week=new Array("星期日","星期一","星期二","星期三","星期四");
attime=time.getFullYear()+"年"+time.getMonth()+"月"+time.getDate()+"日"+" "+week[time.getDay()]+time.getHours()+"时:"+time.getMinutes()+"分:"+time.getSeconds()+"秒";
document.getElementById("clock").value = attime;
}
</script>
</head>
<body>
<form>
<input type="text" id="clock" size="50" />
</form>
</body>
</html>
少了分号; 请注意分号 ; 整个是一个整体
加个;
少个分号,转义字符都要加分号