1

我尝试显示到浏览器日期和时间,但输出错误。
也许我错过了一些东西,但我无法抓住它是什么?
编码是ANSI.

输出:
Current date and time - 都是输出。

代码:

<HTML>
    <HEAD><TITLE>Show date‹&lt;/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>

问题:

  • 如何解决这个问题?
4

1 回答 1

0

从此代码部分:

  document.write("<font size='+5'>");
     document.write(hours + ":" + mins + ":" + secs);
  document.write("</font>);
</SCRIPT>

你在这里错过了"标记=>document.write("</font>");

于 2013-04-08T06:23:51.697 回答