Tip: You can modify some of the code before running
<ptml> <pead> <title> very good Grey calendar code </title> </pead> <body> <style type= "Text/css" > body,td{font-family: "Arial"; font-size:8pt; color: #000000; trout{background: #dddddd; height:24 border:1 solid #999999; Border-top-color: #f4f4f4; Border-left-color: #f4f4f4; tdover{background: #eeeeee; height:20 border:1 solid #ffffff; Border-top-color: #9c9c9c; Border-left-color: #9c9c9c; tdout{background: #eeeeee; height:20 border:1 solid #9c9c9c; Border-top-color: #ffffff; Border-left-color: #ffffff;} </style> <script language= "JScript" > Function tablefunction () {this. Getdatastr=function (y,m) {this. Dayarray=[]; for (Var i=0;i<42;i++) this. Dayarray[i]= ""; for (Var i=0;i<new Date (y,m,0). GetDate (); i++) this. Dayarray[i+new Date (y,m-1,1). Getday ()]=i+1; return this. Dayarray; } this. Gettablestr=function (y,m) {this. Datearray=["Day", "a"," Two "," three "," four "," five "," six "]; This. dstr= "<table oncontextmenu= ' return false ' onselectstart= ' return false ' border= ' 0 ' cellpadding= ' 0 ' cellspacing= ' 0 ' & Gt;n "+" <tr><td colspan= ' 7 ' class= ' Trout ' > "+" <table width= ' 100% ' "height= ' 1 00% ' border= ' 0 ' cellpadding= ' 0 ' cellspacing= ' 0 ' ><tr align= ' center ' >n ' + ' <td width= ' webding S "; font-size:9pt ' onclick= ' tablefunction (). Jumptorun ("B") ' Onmouseover= ' this.style.color= "#ff9900" ' onmouseout= ' this.style.color= ' "' >3</td>n" + "<td id= ' yeartd ' width= ' onmouseover= ' this.style.background= '" #cccccc "' onmouseout= ' this.style.background= '" " Onclick= ' Tablefunction (). Writeselect (This,this.innertext.split ("") [0], "y", false) ' > ' +y+ ' year </td>n ' + ' <td id= ' MONTHTD ' WI Dth= ' onmouseover= ' this.style.background= ' #cccccc ' ' onmouseout= ' this.style.background= ' ' onclick= ' Tablefunction (). Writeselect (This,this.innertext.split ("") [0], "M", false) ' > ' +m+ ' month </td>n ' + ' <td width= ' webdings '; font-size:9pt ' onclick= ' tablefunction (). Jumptorun ("n") ' onmouseover= ' this.style.color= "#ff9900" ' onmouseout= ' this.style.color= ' "' >4</td></tr ></table>n "+" </td></tr>n "+" <tr align= ' center ' >n '; for (Var i=0;i<7;i++) this. dstr+= "<td class= ' trout ' >" +datearray[i]+ "</td>n"; This. dstr+= "</tr>n"; for (Var i=0;i<6;i++) {this. dstr+= "<tr align= ' center ' >n"; for (Var j=0;j<7;j++) {var cs=new Date (). GetDate () ==this. GETDATASTR (Y,M) [i*7+j]? " Tdover ":" Tdout "; This. dstr+= "<TD id= ' TD ' Class= '" +cs+ "' cs= '" +cs+ "' onmouseover= ' this.classname= ' tdover" ' onmouseout= ' if (this.cs!= " Tdover ") this.classname=" Tdout "' > ' +this. GETDATASTR (y,m) [i*7+j]+ "</td>n"; } This. dstr+= "</tr>n"; } this. dstr+= "</tabe>"; return this. DSTR; } this. Writeselect=function (obj,values,action,getobj) {if (values== "") return; if (getobj) {obj.innerhtml=values+ (action== "y"? "Year": "Month"); This. Rewritetablestr (YearTD.innerText.split ("") [0],monthtd.innertext.split ("") [0]); return false; } var strarray=[]; if (action== "Y") {for (Var i=0;i<15;i++) {var year=values-7+i; strarray[i]= "<option value=" "+year+" "+ (values==year?) Selected ":" ") +" > "+year+" Year </option>n "; } obj.innerhtml= "<select id= ' select1 ' onchange= ' tablefunction (). Writeselect (Parentelement,this.value, "Y", tRue) ' onblur= ' yeartd.innertext=this.value+ ' year ' >n ' +strarray.join ("") + "</select>"; Select1.focus (); } if (action== "M") {for (Var i=1;i<13;i++) Strarr ay[i]= "<option value=" "+i+" "+ (i==values?) Selected ":" ") +" > "+i+" month </option>n "; Obj.innerhtml= "<select id= ' select2 ' onchange= ' tablefunction (). Writeselect (Parentelement,this.value, "M", true) ' onblur= ' monthtd.innertext=this.value+ ' month ' ' >n ' +StrArray.join (" ") +" </select> "; Select2.focus (); }} this. Rewritetablestr=function (y,m) {var tarray=this. Getdatastr (Y,M); for (Var i=0;i<tarray.length;i++) {Td[i].innerhtml=tarray[i]; Td[i].classname= "Tdout"; Td[i].cs= "Tdout"; if (New DaTe (). getyear () ==y&&new date (). getmonth () +1==m&&tarray[i]==new date (). GetDate ()) { Td[i].classname= "Tdover"; Td[i].cs= "Tdover"; }}} this. Jumptorun=function (action) {var yearno=yeartd.innertext.split (') [0]; var monthno=monthtd.innertext.split (') [0]; if (action== "B") {if (monthno== "1") {monthno=13; Yearno=yearno-1; } monthtd.innertext=monthno-1+ "Month"; yeartd.innertext=yearno+ "Year"; This. Rewritetablestr (yearno,monthno-1); } if (action== "n") {if (monthno== ")" {monthno=0;yearno=yearno-(-1); } yeartd.innertext=yearno+ "Year"; monthtd.innertext=monthno-(-1) + "month"; This. Rewritetablestr (yearno,monthno-(-1)); } return this; } document.write (Tablefunction (). GETTABLESTR (new Date (). getyear (), new Date (). GetMonth () +1)); </script> <br/> <br/><br/> </body> </ptml></td> </tr> </TABLE&G T
Tip: You can modify some of the code before running