<html>
<head>
<script language="vbscript">
class calendar
dim calendarmonth,calendaryear,calendarday
dim today
dim table1
Private Sub Class_Initialize
today=date
set table1 = document.getElementById("calendartable")
end sub
function tableclear()
rowsnum=1
j=0
for i=0 to 34
table1.rows(rowsnum).cells(j).innerText=""
j=j+1
if j=7 then
j=0
rowsnum=rowsnum+1
end if
next
end function
public property get thedayd()
if len(calendarday)=0 then
calendarday=day(today)
end if
theyeard=calendaryear
end property
public property let thedayd(theday)
calendarday=theday
end property
public property get theyeard()
if len(calendaryear)=0 then
calendaryear=year(today)
end if
theyeard=calendaryear
end property
public property get themonthd()
if len(calendarmonth)=0 then
calendarmonth=month(today)
end if
themonthd=calendarmonth
end property
public property let theyeard(theyear)
calendaryear=theyear
end property
public property let themonthd(themonth)
calendarmonth=themonth
end property
function displayDay()
dim days,theday
dim d
dim todayw
dim rows
dim cells
rows=1
d = calendaryear&"-"&calendarmonth&"-"&"1"
todayw = Weekday(d)
select case calendarmonth
case 1
days=31
case 2
days=runnian(calendaryear)
case 3
days=31
case 4
days=30
case 5
days=31
case 6
days=30
case 7
days=31
case 8
days=31
case 9
days=30
case 10
days=31
case 11
days=30
case 12
days=31
end select
rowsnum=1
j=todayw-1
for i=1 to days
if i=calendarday then
table1.rows(rowsnum).cells(j).innerHTML="<font color='red'>"&i&"</font>"
else
table1.rows(rowsnum).cells(j).innerText=i
end if
j=j+1
if j=7 then
j=0
rowsnum=rowsnum+1
end if
next
end function
function runnian(theyear)
If theyear Mod 100 = 0 Then
If theyear Mod 4 = 0 Then
runnian=29
Else
runnian=28
End If
Else
If theyear Mod 4 = 0 Then
runnian=29
Else
runnian=28
End If
End If
end function
end class
</script>
<script language="vbscript">
function init()
set c=new calendar
c.theyeard=2005
c.themonthd=5
c.thedayd=12
c.displayDay
set chyear=document.getElementById("chooseyear")
set chmonth=document.getElementById("choosemonth")
for i=2003 to 2006
set oOption = document.createElement("OPTION")
oOption.text=i
oOption.value=i
if(i=c.theyeard) then
oOption.selected=true
end if
chyear.add oOption
next
for i=1 to 12
set oOption = document.createElement("OPTION")
oOption.text=i
oOption.value=i
if(i=c.themonthd) then
oOption.selected=true
end if
chmonth.add oOption
next
set c=nothing
end function
function sel()
set chyear=document.getElementById("chooseyear")
set chmonth=document.getElementById("choosemonth")
set c=new calendar
c.tableclear
for i=0 to 3
if(chyear.options(i).selected=true) then
yeard=chyear.options(i).value
c.theyeard=CInt(yeard)
end if
next
for i=0 to 11
if(chmonth.options(i).selected=true) then
monthd=chmonth.options(i).value
c.themonthd=CInt(monthd)
end if
next
c.displayDay
end function
</script>
<style>
.calendarcss{font-family:"Arial";
font-size:12px;
color:#000000;
}
</style>
</head>
<body οnlοad="init()">
<table id="calendartable" class="calendarcss">
<tr>
<td>S</td><td>M</td><td>T</td><td>W</td><td>T</td><td>F</td><td>S</td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
<tr>
<td></td><td></td><td></td><td></td><td></td><td></td><td></td>
</tr>
</table>
<select id="chooseyear" onpropertychange="sel()">
</select>
<select id="choosemonth" onpropertychange="sel()">
</select>
</body>
</html>