2013年10月19日 星期六

javascript-time

javascript-time()


function yudan_time(){
now = new Date();
hours = now.getHours();
minutes = now.getMinutes();
seconds = now.getSeconds();
timeValue = (hours >= 12) ? "下午 " : "上午 ";
timeValue += ((hours > 12) ? hours - 12 : hours) + ":";
timeValue += ((minutes < 10) ? " 0" : " ") + minutes + ":";
timeValue += ((seconds < 10) ? " 0" : " ") + seconds ;
document.getElementById("yudan_clock").innerHTML = timeValue;
setTimeout("yudan_time()",100);}
yudan_time();


document.write("<span id=\"yudan_clock\"></span>");report

沒有留言:

張貼留言