页面时间

function showtime() {
 var day, hours, minutes, seconds, timeValue;
 now = new Date();
 if (now.getDay() == 0)
  day = "星期日"
 if (now.getDay() == 1)
  day = "星期一"
 if (now.getDay() == 2)
  day = "星期二"
 if (now.getDay() == 3)
  day = "星期三"
 if (now.getDay() == 4)
  day = "星期四"
 if (now.getDay() == 5)
  day = "星期五"
 if (now.getDay() == 6)
  day = "星期六"

 ymd = now.getYear() + "年" + (now.getMonth() + 1) + "月" + now.getDate()
   + "日";
 hours = now.getHours();
 minutes = now.getMinutes();
 seconds = now.getSeconds();

 timeValue = ymd;
 timeValue += day;
// timeValue += hours + ":";
// timeValue += ((minutes < 10) ? "0" : "") + minutes + ":";
// timeValue += ((seconds < 10) ? "0" : "") + seconds + "";
 document.getElementById("clock").innerHTML = timeValue;
 setTimeout("showtime()", 100);

你可能感兴趣的:(时间)