'月份处理,默认值为服务器当前月份
if request.querystring("Month")<>"" then
Month_var=cint(request.querystring("Month"))
else
Month_var=month(date())
end if
'上一月、下一月赋值
if Month_var<=1 then
Next_month=Month_var+1
Previous_month=1
else
if Month_var>=12 then
Next_month=12
Previous_month=Month_var-1
else
Next_month=Month_var+1
Previous_month=Month_var-1
end if
end if
<%
function getdays(year,month)
select case month
case 1,3,5,7,10,12:
getdays=31
case 4,6,9,11:
getdays=30
case 2:
if isdate("February 29,"&year) then
getdays=29
else
getdays=28
end if
end select
end function
function getweek(year,month)
getweek=weekday(month&"/1/"&year)
end function
%>
<html>
<style type="text/css">
<!--
.style4 {font-size: xx-small}
-->
</style>
<body>
<table width="200" border="0" align="center">
<tr>
<td width="200">
<div align="center" class="style4"><br>
<%if request("year")="" then
response.write "2006"
else
response.write request("year")
end if
%>年
<%if request("month")="" then
response.write "9"
else
response.write request("month")
end if
%>月日历
</div>
</table>
<br>
<table width="200" border="0" align="center" class="style4" bgcolor="#FFFFFF">
<tr>
<td>日</td>
<td>一</td>
<td>二</td>
<td>三</td>
<td>四</td>
<td>五</td>
<td>六</td>
</tr>
<%
dim days
dim week
if request("year")<>"" then
days=getdays(request("year"),request("month"))
week=getweek(request("year"),request("month"))
else
days=getdays(2006,9)
week=getweek(2006,9)
end if
response.write "<tr>"
if week<>1 then
position=1
do while position<week
response.write "<td> </td>"
position=position+1
loop
end if
current=1
position=week
do while current<=days
if cint(day(now))=current then
response.write "<td><span style=background:#FF0000>"¤t&"</span></td>" (当前日期红色)
else
response.write "<td>"¤t&"</td>" (非当前日期默认)
end if
if position=7 then
position=0
response.write "</tr>"
end if
current=current+1
position=position+1
loop
if position<>1 then
do while position<>8
response.write "<td> </td>"
position=position+1
loop
response.write "</tr>"
end if
%>
</body>
</html>