这篇文章介绍了js局部刷新页面时间具体实现
需要的朋友可以参考一下
复制代码 代码如下:
<head>
<title></title>
<script type="text/javascript">
function GetTime() {
var time = new Date();
var year = timegetFullYear();
var month = timegetMonth() + ; // 月份从开始
var day = timegetDate(); // 注意是getDate()
var hour = timegetHours();
var minute = timegetMinutes();
var sec = timegetSeconds();
var timestring;
if (minute < ) {
timestring
= year + "" + month + "" + day + " " + hour + ":" + minute + ":" + sec;
}
else {
timestring
= year + "" + month + "" + day + " " + hour + ":" + minute + ":" + sec;
}
// div没有value属性
documentgetElementByIdx_x("timeDiv")innerHTML = timestring;
windowsetInterval("GetTime()" );
}
</script>
</head>
<body onload="GetTime()">
<div id="timeDiv">
</div>
</body>