网页时钟 当前时间 备留

<body bgcolor="#fef4d9" ONLOAD=show5()>
////////////////////////////////////////////////////
////////////////////////////////////////////////
///////////////////////////////////////////////
<script language="JavaScript">
<!-- Hide
  var timerID = null
  var timerRunning = false
  function stopclock (){
  if(timerRunning)
  clearTimeout(timerID);
  timerRunning = false
  }
  function showtime () {
  var now = new Date();
  var year = now.getYear();
  var month = now.getMonth() + 1;
  var date = now.getDate();
  var hours = now.getHours();
  var minutes = now.getMinutes();
  var seconds = now.getSeconds();
  var day = now.getDay();
  Day = ["星期天","星期一","星期二","星期三","星期四",""星期五","星期六"];

  var timeValue = "";
  timeValue += (year<1000?year+1900:year) + "年";
  timeValue += (month < 10 ? "0" : "") + month + "月";
  timeValue += (date<10?"0":"") + date + "日  ";
  timeValue += (Day[day]) + "  ";
  timeValue += (hours < 10?"0":"")+hours;
  timeValue += (minutes < 10? ":0" : ":") + minutes;
  timeValue += (seconds < 10? ":0" : ":") + seconds;
  //timeValue += (hours < 12) ? "上午" : "下午";
  document.jsfrm.face.value = timeValue;
  timerID = setTimeout("showtime()",1000);
  timerRunning = true
  }
  function startclock () {
  stopclock();
  showtime()
  }
  //-->

</script>
 <form name='jsfrm'>
                    <input type=text name='face' size=34 value=''>
                  </form>

<body bgcolor="#fef4d9" onLoad="startclock()">

posted @ 2012-06-01 11:59  流失的痕迹  阅读(284)  评论(0编辑  收藏  举报