日期:2014-05-16 浏览次数:20367 次
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <div id=x></div> <script> function show() { today=new Date(); var hours = today.getHours(); var minutes = today.getMinutes(); var seconds = today.getSeconds(); var timeValue = ((hours >12) ? hours -12 :hours); timeValue += ((minutes < 10) ? "<BLINK>:</BLINK>0" : "<BLINK>:</BLINK>") + minutes; timeValue += ((seconds < 10) ? "<BLINK>:</BLINK>0" : "<BLINK>:</BLINK>") + seconds; timeValue += (hours >= 12) ? "<B>pm</B>" : "<B>am</B>"; var d=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"]; document.getElementById("x").innerHTML=today.getFullYear() + "年" + (today.getMonth()+1) + "月"+today.getDate()+"日"+d[today.getDay()] + " " + timeValue; } window.onload=function() { setInterval("show()",1000); } </script> </body> </html>
------解决方案--------------------