名称:在页面上显示当前日期和时间
例子:
使用方法:
复制下面的代码到你的 html 文件的 <body>和</body> 之间:
<table border="1" width="80%">
<tbody>
<tr>
<td bgColor="#000000" width="100%"><font
color="#"><script language="JavaScript"><!--
now = new Date()
hour = now.getHours()
if (hour < 12) {
document.write("现在是: " + now.toLocaleString())
} else if (hour < 18){
document.write("现在是: " + now.toLocaleString())
} else if (hour >= 18) {
document.write("现在是: " + now.toLocaleString())
}
// --></script>
</font></td>
</tr>
</tbody>
</table>
使用说明: