温柔网

 找回密码
 注册

查看: 529|回复: 0

From时钟

[复制链接]
发表于 2004-1-14 18:22:31 | 显示全部楼层 |阅读模式
<script language="JavaScript">

<!--
var timerID = null
var timerRunning = false
function stopclock(){
    if(timerRunning)
        clearTimeout(timerID)
    timerRunning = false
}

function startclock(){
    stopclock()
    showtime()
}

function showtime(){
    var now = new Date()
    var hours = now.getHours()
    var minutes = now.getMinutes()
    var seconds = now.getSeconds()
    var timeValue = "" + ((hours > 12) ? hours - 12 : hours)
    timeValue  += ((minutes < 10) ? ":0" : ":") + minutes
    timeValue  += ((seconds < 10) ? ":0" : ":") + seconds
    if (hours>=6 && hours<=12)
       {timeValue  += ("上午")}
    if(hours>12 && hours<=18)
       {timeValue += ("下午")}
    if(hours>18 && hours <=24)
       {timeValue +=("晚上")}
    if(hours<6)
       {timeValue += ("深夜")}
    document.clock.face.value = timeValue
    timerID = setTimeout("showtime()",1000)
    timerRunning = true
}


//-->
</script>
<form method="OST" name="clock">
  <p>
    <input type="text" name="face" size="11" style="font-size: 9pt">
  </p>
</form>
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|Archiver|手机版|小黑屋|温柔网 ( 浙ICP备13033583号-8 )

GMT+8, 2024-5-2 08:26 , Processed in 0.067016 second(s), 22 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表