-2

这是一组代码:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 

<html xmlns="www.w3.org/1999/xhtml" xml:lang="en">


<title>Lots of Time</title>
<body>
<h1>Times</h1>
<script "type/javascript">
now = new Date();
localtime = now.toString();
utctime = now.toGMTString();
hours = now.getHours();
mins = now.getMinutes();
secs = now.getSeconds();
milli = now.getMilliseconds();
document.write("<h2>Local time:</h2> " + localtime + "<br/>");
document.write("<h2>UTC time</h2> " + utctime);
document.write("<h1>");
document.write(hours + ":" + mins + ":" + secs + ":" milli);
document.write("</h1>");
document.write("<h1>");
document.write(hours + ":" + mins + ":" + secs + ":" milli);
document.write("</h1>");
</script>

</body>
</html>

一切正常,直到我添加了 getMilliseconds();

任何帮助将非常感激。真诚的,艾琳

4

2 回答 2

1

添加一个加号,使其看起来像:

document.write(hours + ":" + mins + ":" + secs + ":" + milli);
于 2013-01-06T00:42:17.737 回答
1

改变

document.write(小时+“:”+分钟+“:”+秒+“:”毫);

document.write(小时+“:”+分钟+“:”+秒+“:”+毫秒);
于 2013-01-06T00:42:35.190 回答