日期:2014-05-16  浏览次数:20386 次

js 实现 时钟

function clockon() {
?thistime= new Date()
?var hours=thistime.getHours()
?var minutes=thistime.getMinutes()
?var seconds=thistime.getSeconds()
?if (eval(hours) <10) {hours="0"+hours}
?if (eval(minutes) < 10) {minutes="0"+minutes}
?if (seconds < 10) {seconds="0"+seconds}
?thistime = hours+":"+minutes+":"+seconds
?$('#hour').html('<font size="100px">'+hours+'</font>');
?$('#minute').html('<font size="100px">'+minutes+'</font>');
?var timer=setTimeout("clockon()",1000)
?}

?

?

<div
???style="margin-left: 150px; padding-top: 35px; width: 267px; height: 91px;"
???id="timerDiv">
??<div style="float: left; margin-left: 40px; padding-top: 10px;"
???id="hour">&nbsp;</div>
??<div
???style="float: left; float: left; margin-left: 65px; padding-top: 10px;"
???id="minute">&nbsp;</div>
??</div>

?