您的位置:首页 > 其它

动态时间、页面中动态显示时间源码!

2011-05-18 13:22 330 查看
<mce:script type="text/javascript"><!--
var timeShow = null;
var diff = new Date().getTime() - 1301735566677;
function tick() {
var millis = new Date().getTime() - diff;
timeShow.innerHTML = new Date(millis).toString();
}
window.onload = function() {
timeShow = document.getElementById("time");
setInterval("tick()", 1000);
}

var week = ['日','一','二','三','四','五','六'];
Date.prototype.toString = function() {
return this.getFullYear()+"年"+
(this.getMonth()+1)+"月"+
this.getDate()+"日 星期"+
week[this.getDay()]+" " +
this.getHours()+":"+
this.getMinutes()+":"+
this.getSeconds();
}
// --></mce:script>
</head>

<body>
<table width="100%">
<tr>
<td align="right" style="font-size:12px;font-family:verdana; line-height:22px" mce_style="font-size:12px;font-family:verdana; line-height:22px">
当前时间是:<span id="time" style="color:#339" mce_style="color:#339"></span>
</td>
</tr>
</table>
</body>
</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: