<html>
<head>
<title>
Show the current time
</title>
<script>
var temp = null;
var timeValue = null;
function divCon()
{
temp = document.getElementById('thetime');
temp.innerText = "Time: " + timeValue;
}
var timerID = null;
var timerRunning = false;
function stopclock()
{
if(timerRunning)
{
clearTimeout(timerID);
}
timerRunning = false;
}
function startclock()
{
stopclock();
showtime();
}
function showtime()
{
var now = new Date(); //Get the current time
var hours = now.getHours(); //Get the current hours
var minutes = now.getMinutes(); //Get the current minutes
var seconds = now.getSeconds(); //Get the current seconds
timeValue = "" +((hours>12)?"PM ":"AM "); //以12?制?示系???
timeValue += ((hours>12)?hours-12:hours);
timeValue += ((minutes<10)?":0":":") + minutes; //以双位显示
timeValue += ((seconds<10)?":0":":") + seconds; //以双位显示
divCon();
timerID = setTimeout("showtime()",1000); //间隔1000毫秒,即1秒
timerRunning = true;
}
</script>
</head>
<body onload="divCon();startclock()">
<center>
<h1>TIME</h1>
<form name = "clock" id = "clock">
<div name="thetime" id ="thetime"></div>
</form>
</center>
</body>
</html>
<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><font color="#000000"><img height="585" alt="" src="http://p.blog.csdn.net/images/p_blog_csdn_net/shenshuibomb/EntryImages/20081223/Date.JPG" width="923"><span lang="EN-US" style="FONT-SIZE: 10.5pt; FONT-FAMILY: Century; mso-bidi-font-size: 12.0pt; mso-fareast-font-family: 'MS 明朝'; mso-bidi-font-family: 'Times New Roman'; mso-font-kerning: 1.0pt; mso-ansi-language: EN-US; mso-fareast-language: JA; mso-bidi-language: AR-SA"><shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"><stroke joinstyle="miter"></stroke><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><lock v:ext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" style="WIDTH: 425.25pt; HEIGHT: 269.25pt" type="#_x0000_t75"><imagedata src="file:///C:%5CDOCUME~1%5Cwangzhi%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.png" o:title="Date"></imagedata></shape></span><stroke joinstyle="miter"></stroke></font><formulas><f eqn="if lineDrawn pixelLineWidth 0"></f><f eqn="sum @0 1 0"></f><f eqn="sum 0 0 @1"></f><f eqn="prod @2 1 2"></f><f eqn="prod @3 21600 pixelWidth"></f><f eqn="prod @3 21600 pixelHeight"></f><f eqn="sum @0 0 1"></f><f eqn="prod @6 1 2"></f><f eqn="prod @7 21600 pixelWidth"></f><f eqn="sum @8 21600 0"></f><f eqn="prod @7 21600 pixelHeight"></f><f eqn="sum @10 21600 0"></f></formulas><path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"></path><lock v:ext="edit" aspectratio="t"></lock></shapetype><shape id="_x0000_i1025" style="WIDTH: 425.25pt; HEIGHT: 269.25pt" type="#_x0000_t75"><imagedata src="file:///C:%5CDOCUME~1%5Cwangzhi%5CLOCALS~1%5CTemp%5Cmsohtml1%5C01%5Cclip_image001.png" o:title="Date"></imagedata></shape>
分享到:
相关推荐
显示当前时间 有时候网页制作需要获取到当前时间 并显示出来 这个代码可以帮你 显示就像这样:2011年9月19号 星期一 15:20:22
使用javascript自定义方法来显示系统当前的时间
C# 窗体显示当前系统时间的例子DEMO
这是一款自适应式网页显示动态日期时间的html源码模板,可以通过选择不同的时间显示出不同的对应信息,比较适合初学者与新手小白学习和借鉴。
超简单的 html+css+js 三个文件构成的,网页上动态显示时间XX:XX:XX 超简单的 html+css+js 三个文件构成的,网页上动态显示时间XX:XX:XX
更多资源请查看: http://download.csdn.net/user/njzdl
根据系统时间 网页显示不同问候语代码~~~
摘要:.NET源码,Ajax相关,无刷新 在网页上显示当前时间,不刷新网页,懂行的人一看就知道是与AJAX有关系,下的AJAX,那么就请参考一下吧,挺基础的AJAX例子。
java实现显示系统时间,带源代码。不错的小功能,常用在网站上显示当前时间。
php显示当前时间的代码 在网页上显示当前的时间状态 一段小代码 自己留着用用
网页编辑时候,需要显示当前时间功能,可以参考这个代码实现。
兼容所有浏览器,显示格式为:2014年1月2日 23:30:44 星期四
js 特效 html 特效 点击显示时间 js 特效 html 特效 点击显示时间
网页上显示一个系统时间 通过每一秒的变化都会相应的变化
c sharp, javascript,ajax, vs2017,显示服务器时间和本地时间,显示值班人员。使用前先要配置好网站。
基于jQuery的插件,用于在页面中显示当前的日期和系统时钟。 例:$('div').smartClock();
CSS+JS注册页面+显示当前时间 用css和js编写的看看吧
jQuery Clock插件,方便的在你网页上显示日期和时间,适时显示当前时间,显示带日期、带星期的网页时间。通过这个实例你将了解到jquery.jclock.js的用法,除实例的调用方法外,本插件还可以完成更多的时间显示,让你...
这是我从项目中抽取出来的用JS实现的Java实现页面动态获取时间的小例子,希望对大家带来帮助
MagicAjax入门程序之无刷新显示当前时间