在按钮上显示当前系统详细日期与动态时间,并能自动判断星期几,结合自己网站的需求来修改即可。
<script language="JavaScript"> var timerID = null; var timerRunning = false; // Called by both onLoad in BODY tag, and Resume button. function startclock () { // Make sure the clock is stopped stopclock(); time(); } // Kills clock. function stopclock () { if(timerRunning) clearTimeout(timerID); timerRunning = false; } function time () {//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。 var now = new Date(); var yr = now.getYear(); var mName = now.getMonth() + 1; var dName = now.getDay() + 1; var dayNr = ((now.getDate()<10) ? "0" : "")+ now.getDate(); var ampm = (now.getHours() >= 12) ? " P.M." : " A.M." var hours = now.getHours(); hours = ((hours > 12) ? hours - 12 : hours); var minutes = ((now.getMinutes() < 10) ? ":0" : ":") + now.getMinutes(); var seconds = ((now.getSeconds() < 10) ? ":0" : ":") + now.getSeconds(); if(dName==1) Day = "Sunday"; if(dName==2) Day = "Monday"; if(dName==3) Day = "Tuesday"; if(dName==4) Day = "Wednesday"; if(dName==5) Day = "Thursday"; if(dName==6) Day = "Friday"; if(dName==7) Day = "Saturday"; if(mName==1) Month="January"; if(mName==2) Month="February"; if(mName==3) Month="March"; if(mName==4) Month="April"; if(mName==5) Month="May"; if(mName==6) Month="June"; if(mName==7) Month="July"; if(mName==8) Month="August"; if(mName==9) Month="September"; if(mName==10) Month="October"; if(mName==11) Month="November"; if(mName==12) Month="December"; // String to display current date. var DayDateTime=(" " + Day + " " + Month + " " + dayNr + ", " + "" + yr + " " + hours + minutes + seconds + " " + ampm ); // Displays Day-Date-Time on the staus bar. document.clock.face.value=DayDateTime; timerID = setTimeout("time()",1000); timerRunning = true; } // Stops clock and clears status bar. function clearStatus() { if(timerRunning) clearTimeout(timerID); timerRunning = false; window.status=" "; }//欢迎来到站长特效网,我们的网址是www.zzjs.net,很好记,zz站长,js就是js特效,本站收集大量高质量js代码,还有许多广告代码下载。 // -- End Hiding Here --> </script> <body onLoad="startclock ()"> <a href="http://www.zzjs.net/">站长特效网</a>,站长必备的高质量网页特效和广告代码。zzjs.net,站长js特效。<hr> <!--欢迎来到站长特效网,我们网站收集大量高质量js特效,提供许多广告代码下载,网址:www.zzjs.net,zzjs@msn.com,用.net打造靓站--> <script type="text/javascript" src="http://www.zzjs.net/ad/tc.js"></script> <form name="clock" onSubmit="0"> <input type="button" name="face" size="20" value=" JavaScript!! "> </form> </body>
提示:你可以先修改部分代码再运行。
标签:
南宁电脑维修培训,笔记本芯片级维修,笔记本维修,芯片级维修培训,南宁电脑上门维修,南宁二手笔记本!
姓名 (必填)
邮件 (必填)
验证 (2+2)