function show(){ var date = new Date(); //日期对象 var now = ""; now = date
getFullYear()+"年 "; //读英文就行了 now = now + (date
getMonth()+1)+"月 "; //取月的时候取的是当前月-1 如果想取当前月+1就可以了 now = now + date
getDate()+"日 "; now = now + date
getHours()+"时 "; now = now + date
getMinutes()+"分 "; now = now + date
getSeconds()+"秒 "; document
getElementById("nowDiv")
innerHTML = now; //div 的 html 是 now 这个字符串 setTimeout("show()",1000); //设置过1000 毫秒就是1 秒,调用show 方法 } 实时走动的数字时钟 如:下午14:15:00 第一步:在区域加入以下代码 XML/HTML 代码 function tick() { var hours, minutes, seconds, xfile; var intHours, intMinutes, intSeconds; var today; today = new Date(); intHours = today
getHours(); intMinutes = today
getMinutes(); intSeconds = today
getSeconds(); if (intHours == 0) { hours = "12:"; xfile = "午夜"; } else if (intHours < 12) { hours = intHou