现在的位置: 首页 > 综合 > 正文

网页时钟 当前时间 备留

2012年11月17日 ⁄ 综合 ⁄ 共 1237字 ⁄ 字号 评论关闭

<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()">

抱歉!评论已关闭.