标签:htm span turn oct today text innerhtml blog lang
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> 3 <head> 4 <meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> 5 <title>计时事件表</title> 6 <script> 7 function startTime() 8 { 9 var today=new Date() 10 var h=today.getHours() 11 var m=today.getMinutes() 12 var s=today.getSeconds() 13 14 m = checkTime(m) 15 s = checkTime(s) 16 document.getElementById(‘txt‘).innerHTML=h+":"+m+":"+s 17 t = setTimeout(‘startTime()‘, 500) 18 } 19 20 function checkTime(i) 21 { 22 //小于10的前面补0 23 if(i<10) 24 {i="0"+i} 25 return i 26 } 27 </script> 28 </head> 29 <body onload="startTime()"> 30 <div id="txt"></div> 31 </body> 32 </html>
标签:htm span turn oct today text innerhtml blog lang
原文地址:http://www.cnblogs.com/CAODADA/p/6132484.html