大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 技术开发 -> Script -> 日历

日历

时间: 2021-07-31 作者:daque

把下列代码介入<head>...</head>之间:<script language="javascript" type="text/javascript">//创造一个数组,用来寄存每个月的天数function montharr(m0, m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11) {this[0] = m0;this[1] = m1;this[2] = m2;this[3] = m3;this[4] = m4;this[5] = m5;this[6] = m6;this[7] = m7;this[8] = m8;this[9] = m9;this[10] = m10;this[11] = m11;}//实行月历function calendar() {var monthnames = "janfebmaraprmayjunjulaugsepoctnovdec";var today = new date();var thisday;var monthdays = new montharr(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);year = today.getyear() +1900;thisday = today.getdate();if (((year % 4 == 0) && (year % 100 != 0))  (year % 400 == 0)) monthdays[1] = 29;ndays = monthdays[today.getmonth()];firstday = today;firstday.setdate(1);testme = firstday.getdate();if (testme == 2) firstday.setdate(0);startday = firstday.getday();document.write("<table border='0' cellspacing='0' cellpadding='2' align='center' bgcolor='#0080ff'>")document.write("<tr><td><table border='0' cellspacing='1' cellpadding='2' bgcolor='silver'>");document.write("<tr><th colspan='7' bgcolor='#c8e3ff'>");var daynames = new array("礼拜日","礼拜一","礼拜二","礼拜三","礼拜四","礼拜五","礼拜六");var monthnames = new array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");var now = new date();document.writeln("<font style='font-size:9pt;color:#330099'>" + "纪元 " + now.getyear() + "年" + monthnames[now.getmonth()] + " " + now.getdate() + "日 " + daynames[now.getday()] + "</font>");document.writeln("</th></tr><tr><th bgcolor='#0080ff'><font style='font-size:9pt;color:white'>日</font></th>");document.writeln("<th bgcolor='#0080ff'><font style='font-size:9pt;color:white'>一</font></th>");document.writeln("<th bgcolor='#0080ff'><font style='font-size:9pt;color:white'>二</font></th>");document.writeln("<th bgcolor='#0080ff'><font style='font-size:9pt;color:white'>三</font></th>");document.writeln("<th bgcolor='#0080ff'><font style='font-size:9pt;color:white'>四</font></th>");document.writeln("<th bgcolor='#0080ff'><font style='font-size:9pt;color:white'>五</font></th>");document.writeln("<th bgcolor='#0080ff'><font style='font-size:9pt;color:white'>六</font></th>");document.writeln("</tr><tr>");column = 0;for (i=0; i<startday; i++) {document.writeln("\n<td><font style='font-size:9pt'> </font></td>");column++;}for (i=1; i<=ndays; i++) {if (i == thisday) {document.writeln("</td><td align='center' bgcolor='#ff8040'><font style='font-size:9pt;color:#ffffff'><b>")}else {document.writeln("</td><td bgcolor='#ffffff' align='center'><font style='font-size:9pt;font-family:arial;font-weight:bold;color:#330066'>");}document.writeln(i);if (i == thisday) document.writeln("</font></td>")column++;if (column == 7) {document.writeln("<tr>"); column = 0;}}document.writeln("<tr><td colspan='7' align='center' valign='top' bgcolor='#0080ff'>")document.writeln("<form name='clock' onsubmit='0'><font style='font-size:9pt;color:#ffffff'>")document.writeln("此刻功夫:<input type='text' name='face' align='top'></font></td></tr></table>")document.writeln("</td></tr></table></form>");}</script><script language="javascript">var timerid = null;var timerrunning = false;function stopclock (){if(timerrunning)cleartimeout(timerid);timerrunning = false;}//表露暂时功夫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" : ":") + minutestimevalue += ((seconds < 10) ? ":0" : ":") + secondstimevalue += (hours >= 12) ? " 下昼 " : " 上昼 "document.clock.face.value = timevalue;timerid = settimeout("showtime()",1000);//树立超时,使功夫动静表露timerrunning = true;}function startclock () {stopclock();showtime();}</script> 再介入下列代码:<body background="bg1.jpg"onload="startclock(); timerone=window.settimeout" text="#000000"><b><div align="center"></div><script language="javascript" type="text/javascript"><!--document.write("")calendar();//--></script></body> 

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.