<div class="codetitle"> <span><a style="CURSOR: pointer" data="62702" class="copybut" id="copybut62702" onclick="doCopy('code62702')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code62702"> <br> <br> <br><script type="text/javascript"> <BR>function startTime() <BR>{ <BR>var today=new Date() <BR>var h=today.getHours() <BR>var m=today.getMinutes() <BR>var s=today.getSeconds() <BR>// add a zero in front of numbers<10 <BR>m=checkTime(m) <BR>s=checkTime(s) <BR>document.getElementById( 'txt').innerHTML=h ":" m ":" s <BR>t=setTimeout('startTime()',500) <BR>} <BR>function checkTime(i) <BR>{ <BR>{ <BR> if (i<10) <BR>{i="0" i} <BR>return i <BR>} <BR></script> <br> <br> <br><div id="txt"></div> <br> <br> </div> <br> <div class="codetitle"><span><a style="CURSOR: pointer" data="54416" class="copybut" id="copybut54416" onclick="doCopy('code54416')"><u> </u>複製程式碼</a></span></div> 程式碼如下:<div class="codebody" id="code54416"> <br> <br><script type="text/javascript"> <BR>var d=new Date() <BR>var weekday=new Array(7) <BR>weekday[0]="星期日" <BR>weekday[1]="星期一" <BR>weekday[2]="星期二" <BR>weekday[3]="星期三" <BR>weekday[4]="星期四" <BR>weekday[5]="星期五" <BR>weekday[6]="星期六" <BR>document.write("今天是" weekday[d. getDay()]) <BR></script> </div>