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

<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>

你可能感兴趣的:(Date,function,null)