Calendar-News _ time date of the specified date

Source: Internet
Author: User
<p><script language= "JavaScript" > var months = new Array ("One", "two", "three", "four", "five", "six", "seven", "eight", "Nine", "Ten", "Ten" One "," 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; </P> <P> function getdays (month, year) {if (1 = month) return ((0 = year% 4) && (0!= (year% 10 0)) | | (0 = year% 400)? 29:28; else return daysinmonth[month]; }</p> <P> function Gettoday () {this.now = new Date (); This.year = This.now.getFullYear (); This.month = This.now.getMonth (); This.day = This.now.getDate (); }</p> <P> 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 ());</p> <P> for (var intweek = 0; Intweek & Lt 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.innerhTML = "" +daily+ ""; daily++; else {cell.classname= "CALENDARTD"; Cell.innertext = ""; }} document.all.year.value=year; document.all.month.value=month+1; }</p> <P> function Submonth () {if (month-1) <0) {month=11; Year=year-1; else {month=month-1; Calendar (); }</p> <P> function Addmonth () {if (month+1) >11) {month=0; year=year+1; else {month=month+1; Calendar (); }</p> <P> 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></P> <P><Script> function Buttonover () {var obj = window.event.srcElement; Obj.runtimeStyle.cssText = "Background-color: #FFFFFF"; Obj.classname= "Hover"; }</p> <p>function buttonout () {var obj = Window.event.srcElement; Window.settimeout (function () {obj.runtimeStyle.cssText = "";},300);} </Script></P> <P><Style> Input {font-family:verdana;font-size:9pt;text-decoration:none; Background-color: #FFFFFF; height:20px;border:1px solid #666666; color: #000000;} </P> <p>. 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;} </P> <p>. 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;} </P> &LT P;. 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;} </P> <p>. 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%;} </P> <p>. Daybutton {font-family:webdings;font-size:9pt;font-weight:bold;color: #243F65; cursor:hand;text-decoration:none;} </P> <P></Style></P> <P> <table border= "0" cellpadding= "0" cellspacing= "1" class= " Calendar "id=" caltable "> <thead> <tr align=" center "valign=" Middle "> <td colspan=" 7 class= "titl E "> 3 <input name=" year "type=" text "size=" 4 "maxlength=" 4 "onkeydown=" if (event.keycode==13) {setdate ()} "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" onkeydown= "if (event.keycode==13) {setdate ()}" onkeyup= " This.value=this.value.replace (/[^0-9]/g, ' ")" onpaste= "This.value=this.value.replace (/[^0-9]/g, ')" > Month 4 </td > </tr> <tr align= "center" valign= "Middle" > <script language= "JavaScript" > document.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> ' + day S[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 onclick= "getdiary ()" > <script language= "JavaScript" > for (var intweeks = 0; intweeks < 6; intweeks++ ) {document.write ("<tr >"); for (var intdays = 0; intdays < days.length;intdays++) document.write ("<td class=calendartd onmouseover=" Buttonover (); ' onmouseout= ' buttonout (); ' ></TD> "); document.write ("</TR>"); } </Script> </TBODY> </TABLE> <script language= "JavaScript" > Calendar (); </Script></P>
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]

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.