我不断收到此错误消息:
未捕获的 SyntaxError:意外的标识符
向时钟添加毫秒时。我是从书本上抄下来的,所以不知道哪里出了问题。
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN">
<html>
<head>
<title>Event Test</title>
</head>
<body>
<h1>Event Test</h1>
<script type="text/javascript">
now = new Date();
localtime = now.toString();
utctime = now.toGMTString();
document.write("<strong>Local time:</strong> "
+ localtime + "<br/>");
document.write("<strong>UTC time:</strong> " +
utctime);
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
mil = now.getMilliseconds();
document.write("<h1>");
document.write(hours + ":" + minutes + ":" + seconds + ":" mil);
document.write("</h1>");
</script>
</body>
</html>