A very nice script calendar

Source: Internet
Author: User
Scripts | calendar <script language= "JavaScript" > var months = new Array ("One", "two", "three", "four", "five", "six", "seven", "eight", "Nine", "Ten", "11", "12"); var daysinmonth = new Array (31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); var days = new Array ("Day", "one", "two", "three", "four", "five", "six"); var classtemp; var today=new gettoday (); var year=today.year; var month=today.month; var newcal; function getdays (month, year) {if (1 = month) return ((0 = year% 4) && (0!= (year% 100)) | | (0 = year% 400)? 29:28; else return daysinmonth[month]; function Gettoday () {this.now = new Date (); This.year = This.now.getFullYear (); This.month = This.now.getMonth (); This.day = This.now.getDate (); function Calendar () {newcal = new Date (year,month,1); Today = new Gettoday (); var day =-1; var startday = Newcal.getday (); var endday=getdays (Newcal.getmonth (), newcal.getfullyear ()); var daily = 0; if ((Today.year = = Newcal.getfullyear ()) && (Today.month = = Newcal.getmonth ())) {day = Today.day; } var caltable = Document.all.caltable.tBodies.calendar; var intdaysinmonth =getdays (Newcal.getmonth (), newcal.getfullyear ()); for (var intweek = 0; Intweek < caltable.rows.length;intweek++) for (var intday = 0;intday < Caltable.rows[intweek ].cells.length;intday++) {var cell = Caltable.rows[intweek].cells[intday]; var montemp= (Newcal.getmonth () +1) <10? ("0" + (Newcal.getmonth () +1)):(Newcal.getmonth () +1); if (Intday = = startday) && (0 = daily) {daily = 1;} var daytemp=daily<10? ("0" +daily):(daily); var d= "<" +newcal.getfullyear () + "-" +montemp+ "-" +daytemp+ ">"; if (day==daily) cell.classname= "Daynow"; else if (intday==6) cell.classname = "Daysat"; else if (intday==0) cell.classname = "Daysun"; else Cell.classname= "Day"; if (Daily > 0) && (daily <= intdaysinmonth)) {cell.innertext = daily; daily++; else {cell.classname= "CALENDARTD"; Cell.innertext = ""; }} document.all.year.value=yEar document.all.month.value=month+1; The function Submonth () {if (month-1) <0) {month=11; Year=year-1; else {month=month-1; Calendar (); The function Addmonth () {if (month+1) >11) {month=0; year=year+1; else {month=month+1; Calendar (); function Setdate () {if (document.all.month.value<1| | DOCUMENT.ALL.MONTH.VALUE&GT;12) {alert ("The effective range of the month is between 1-12!"); Return } year=math.ceil (Document.all.year.value); Month=math.ceil (document.all.month.value-1); Calendar (); }</script><script>function Buttonover () {var obj = window.event.srcElement; obj.runtimeStyle.CSSText = " Background-color: #FFFFFF ";//Obj.classname=" Hover ";} function Buttonout () {var obj = window.event.srcElement; window.settimeout (function () {obj.runtimeStyle.cssText = "";}, 300);} </script><style>input {font-family:verdana;font-size:9pt;text-decoration:none;background-color: # ffffff;height:20px;border:1px solid #666666; color: #000000;}. Calendar {font-family: Verdana;text-decoration:none;width:170;background-color: #C0D0E8; font-size:9pt;border:0px dotted #1C6FA5; CALENDARTD {font-family:verdana;font-size:7pt;color: #000000; Background-color: #f6f6f6; height:20px;width:11%; Text-align:center}. Title {font-family:verdana;font-size:11pt;font-weight:normal;height:24px;text-align:center;color: #333333; Text-decoration:none;background-color: #A4B9D7; Border-top-width:1px;border-right-width:1px;border-bottom-width: 1px;border-left-width:1px;border-bottom-style:1px;border-top-color: #999999; Border-right-color: #999999; Border-bottom-color: #999999; Border-left-color: #999999;}. Day {font-family:verdana;font-size:7pt;color: #243F65; Background-color: #E5E9F2; height:20px;width:11%;text-align: Center}. Daysat {font-family:verdana;font-size:7pt;color: #FF0000; Text-decoration:none;background-color: #E5E9F2; text-align:center;height:18px;width:12%}. Daysun {font-family:verdana;font-size:7pt;color: #FF0000; text-decoration:none;background-Color: #E5E9F2; text-align:center;height:18px;width:12%;}. Daynow {font-family:verdana;font-size:7pt;font-weight:bold;color: #000000; Background-color: #FFFFFF; height:20px; Text-align:center}. Daytitle {font-family:verdana;font-size:9pt;color: #000000; Background-color: #C0D0E8; height:20px;width:11%; Text-align:center}. Daysattitle {font-family:verdana;font-size:9pt;color: #FF0000; Text-decoration:none;background-color: #C0D0E8; text-align:center;height:20px;width:12%}. Daysuntitle {font-family:verdana;font-size:9pt;color: #FF0000; Text-decoration:none;background-color: #C0D0E8; text-align:center;height:20px;width:12%}. Daybutton {font-family:webdings;font-size:9pt;font-weight:bold;color: #243F65; cursor:hand;text-decoration:none;} </style><table border= "0" cellpadding= "0" cellspacing= "1" class= "Calendar" id= "Caltable" ><thead> & LT;TR align= "center" valign= "Middle" > <td colspan= "7" class= "Title" > <a href= "Javascript:submonth ();" Titl E= "Previous month "class=" Daybutton ">3</a> <input name=" Year "type=" text "size=" 4 "maxlength=" 4 "onkeyup=" this.value= This.value.replace (/[^0-9]/g, ' ")" onpaste= "This.value=this.value.replace (/[^0-9]/g, ')" > Year <input name= " Month "type=" text "size=" 1 "maxlength=" 2 "onkeyup=" This.value=this.value.replace (/[^0-9]/g, "") "onpaste=" This.value =this.value.replace (/[^0-9]/g, ') ' > Month <a href= javascript:addmonth (); "Title=" Next month "class=" Daybutton ">4< /a> </td> </tr> <tr align= "center" valign= "Middle" > <script language= "JavaScript" > Docum Ent.write ("<td class=daysuntitle id=diary >" + days[0] + "</TD>"); for (var intloop = 1; intloop < days.length-1;intloop++) document.write ("<td class=daytitle id=diary>" + Days [Intloop] + "</TD>"); document.write ("<td class=daysattitle id=diary>" + days[intloop] + "</TD>"); </Script> </TR> </thead><tbody border=1 cellspacing= "0" cellpadding= "0" id= "Calendar" Align=center > <script language= "JavaScript" > for (var intweeks = 0; intweeks < 6; intweeks++) {document.write ("<tr style= ' Cursor:hand ' >"); for (var intdays = 0; intdays < days.length;intdays++) document.write ("<td class=calendartd ></TD>"); document.write ("</TR>"); } </script></tbody></table><script language= "JavaScript" > Calendar ();</script>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.