我尝试显示到浏览器日期和时间,但输出错误。
也许我错过了一些东西,但我无法抓住它是什么?
编码是ANSI
.
输出:
Current date and time
- 都是输出。
代码:
<HTML>
<HEAD><TITLE>Show date‹</TITLE></HEAD>
<BODY>
<H1>Current date and time</H1>
<p>
<SCRIPT LANGUAGE="JavaScript">
now = new Date();
localtime = now.toString();
utctime = now.toGMTString();
hours = now.getHours();
mins = now.getMinutes();
secs = now.getSeconds();
document.write("<b>Current time: </b>" + localtime + "<BR>");
document.write("<b>Asolute time: </b>" + utctime + "</p>");
document.write("<font size='+5'>");
document.write(hours + ":" + mins + ":" + secs);
document.write("</font>);
</SCRIPT>
</BODY>
</HTML>
问题:
- 如何解决这个问题?