设为首页 加入收藏
当前位置:首页 > 整站内容 > 特效代码 > 时间日期 > 详细内容
Form中的时钟
发布时间:2010-1-27  阅读次数:10060  字体大小: 【】 【】【

<html>
<head>
<title>网页特效|Linkweb.cn/Js|---Form中的时钟</title>
<style type="text/css">
<!--
body {   font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
  A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active         { font: 9pt "宋体"; cursor: hand; color: #FF0033 }
-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body onLoad="startclock();">
<br>
<br>
<center><font color=red face="隶书" size=6>Form中的时钟</font></center>
<br>
<br><center>
<table border=0 bordercolor=blue borderlight=green style="border-collapse: collapse" cellpadding="0" cellspacing="0">
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面为效果显示区!</strong></font></td></tr><tr><td align=center><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="POST" name="clock">
                                       <p>
                                           <input type="text" name="face" size="11" style="font-size: 9pt">
                                       </p>
                                   </form></td></tr>
</table></center>
<br>
<br>
<center>
&nbsp;<SCRIPT LANGUAGE="JavaScript">

<!-- hide

function goHist(a)

{

     history.go(a);

}

//-->

</script></center>
<br>
<br>
</body>
</html>

预览效果

天猫商城    聚划算    天猫电器城    淘宝旅行    天猫超市    淘宝游戏    天猫品牌特卖    天猫母婴

上一篇:立体显示的时钟 下一篇:农历日历
我要评论
  • 匿名发表
  • [添加到收藏夹]
  • 发表评论:(匿名发表无需登录,已登录用户可直接发表。) 登录状态:未登录
最新评论
所有评论[0]
    暂无已审核评论!

全站链接: 
收录查询
分享按钮