自己写的asp日历控件
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>日历</title> </head> <body> <% Function CountDays(iMonth,iYear) select case iMonth case 1,3,5,7,8,10,12 CountDays=31 case 2 if isdate("2/29" & iYear) then CuntDays=29 else CountDays=28 End if case 4,6,9,11 CountDays=30 End Select end function function FirstDay(iMonth,iYear) FirstDay=weekday(iMonth&"/1/"& iYear) End Function dim mMonth,mYear if request.QueryString.count>0 and request.QueryString("month")<> "" then mMonth=request.QueryString("month") mYear=request.QueryString("year") if mMonth=0 then mYear=int(mYear)-1 mMonth=12 elseif mMonth>12 then mYear=int(mYear)+1 mMonth=1 End If else mMonth=month(date()) mYear=year(date()) end if dim days if mMonth=1 then days=CountDays(12,mYear-1) else days=CountDays(mMonth-1,mYear) End If mdate=day(date()) response.Write("<center>"&myear&"年"&mmonth&"月</center>") %> <table align=center> <tr> <td><a href="?month=<%=int(mMonth)-1%>&year=<%=mYear%>"><img src="gd_left.png" width="35" height="112" /></a></td> <td> <table border=1 align=center> <tr> <td align=right>星期日</td> <td align=right>星期一</td> <td align=right>星期二</td> <td align=right>星期三</td> <td align=right>星期四</td> <td align=right>星期五</td> <td align=right>星期六</td> </tr><tr> <% j=1 l=1 m=FirstDay(mMonth,mYear) k=CountDays(mMonth,mYear) days=days-m+2 if m<=5 then n=35 else n=42 End If for i=1 to n response.Write("<td align='right'>") if i>=m and j<=k then If mdate=j and int(mYear)=int(year(date())) And int(mMonth)=int(month(date())) then response.Write("<font color='red'>"&j&"</font>") else response.Write(j) end if j=j+1 elseif i>m then response.Write("<font color='#9A8B90'>"&l&"</font>") l=l+1 elseif i<m then response.Write("<font color='#9A8B90'>"&days&"</font>") days=days+1 else response.Write(" ") End If response.Write("</td>") If i mod 7=0 then response.Write("</tr><tr>") end if Next %> </tr> </table> </td> <td> <a href="?month=<%=int(mMonth)+1%>&year=<%=mYear%>"><img src="gd_right.png" width="35" height="112" /></a> </td> </tr> </table> </body> </html>