JS动态显示时间

来源:互联网 发布:恒大淘宝股票834338 编辑:程序博客网 时间:2024/06/05 03:10
<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><script language="javascript">function disptime(){var time = new Date();     //获得当前时间var hour = time.getHours();var minute = time.getMinutes();var second = time.getSeconds();document.myForm.myclock.value = time.getHours()+":"+time.getMinutes()+":"+time.getSeconds()+"";var myTime = setTimeout("disptime()",1000);   //设置定时器,定时刷新显示时钟}</script><style>input{font-size:30px;border-style:none;background-color:#FF8B3B;}</style></head><body onLoad="disptime()"><form name="myForm"><table width="100%" border="0" align="center"><tr><td><h2>当前时间:<input type="text" name="myclock" size="10"></h2></td></tr></table></form></body></html>

0 0
原创粉丝点击