标签:
<html>
<head>
<title>日期</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript">
function showTime(){
window.setInterval("displayTime()",1000);
}
function displayTime(){
//获取元素节点
var timeDiv = document.getElementById("timeDiv");
//获取系统时间
var time = new Date();
var strTime = time.toLocaleString();
//将系统时间设置到div中
timeDiv.innerHTML = strTime;
}
</script>
</head>
<body onload="showTime()">
<div id="timeDiv"></div>
</body>
</html>
标签:
原文地址:http://www.cnblogs.com/wangqiang4518/p/5727730.html