Código fuente de 'Calendario multianual 2.asp'

<html>
<head>
<title>Calendario multianual 2 - Códigos asp, programacion asp, descargas asp, rutinas asp</title>
</head>
<p align="center"><b><font size="3">Calendario multianual 2</font></b></p>
<br>
<body style="font-family: Arial; font-size: 9pt">
<%
' Calendario en ASP
' Description: Calendario dinámico
' Matt Pantana 
' Inputs:You can input the month or the year, but neither is required 
%>

<%
    response.expires=0
    dim CurMonth
    dim CurDay
    dim CurYear
    dim NumOfDays
    dim CurCell
    dim onDay
    dim FoundFirst
    CurMonth = request.querystring("cmonth")
    CurYear = request.querystring("cyear")
    CurDay = request.querystring("cday")
    
    if CurMonth = "" then curMonth = month(date)
    if CurYear = "" then CurYear = year(date)
    if CurDay = "" then CurDay = day(date)
'    FirstDay = weekday(CurMonth & "/01/" & CurYear)
    FirstDay = weekday("01/" & CurMonth & "/" & CurYear)
    
    cmonth = CurMonth
    cyear = CurYear
    NumOfDays = getlastday(cmonth,cyear)
    FoundFirst = false
    curcell = 1
    onDay = 0
    function GetLastDay( tmonth, tyear )
    tmonth = tmonth + 1
    if tmonth > 12 Then
    tmonth = tmonth - 12
    tyear = tyear + 1
    End if
    
    
    Dim x
    x = DateAdd("d", -1, "01/" & tmonth & "/" & tyear)
    GetLastDay = Day( x )
    End function
    
    rows = 5
    if firstday >= 5 and numofdays = 31 then
    rows = 6
    end if
    if firstday >= 6 and numofdays = 30 then
    rows = 6
    end if
    
    function DayOf()
    if foundFirst then
    	 onDay = OnDay + 1
    	 if onDay > NumofDays then
    	 DayOf = ""
    	 else
    	 DayOf = onDay
    	 end if
    	 
    	else
    	 if curcell = Firstday or firstday = 1 then foundfirst = true
    	 
    	 if foundFirst then
    	 onDay = OnDay + 1
    		if onDay > NumofDays then
    		DayOf = ""
    	
    		else
    		DayOf = onDay
    		
    	 end if
    	 else
    	 DayOf = ""
    	 end if
    	 
    	end if
    curcell = curcell + 1
    	 if (OnDay + 1) = int(CurDay) and int(CurMonth) = int(month(date)) and int(CurYear) = year(date) then 
    	 bgcolor = "yellow"
    	 else
    	 bgcolor = ""
    	 end if
    end function
    %>
    
    <script language="VBScript">
    Sub cmonth_onchange
    frm.submit
    end sub
    Sub cyear_onchange
    frm.submit
    end sub
    </script>
    
    
    <table width="350" border="0" cellspacing="0" cellpadding="0">
    
    <form name=frm method=get action="Calendario multianual 2.asp">
    <tr> 
    <td width="37"> </td>
    <td width="137"> </td>
    <td width="144"> </td>
    <td width="32"> </td>
    </tr>
    <tr> 
    <td width="37"> </td>
    <td width="137"> 
    <select name="cmonth">
    <% for i = 1 to 12 %>
    <option value="<%=i%>" <%if int(curmonth) = i then response.write("Selected")%>><%=monthname(i)%></option>
    <% next %>
    </select>
    </td>
    <td width="144"> 
    <select name="cyear">
    <% for i = 2050 to 1980 step -1 %>
    <option value="<%=i%>" <%if int(curyear) = i then response.write("Selected")%>><%=i%></option>
    <% next %>
    </select>
    </td>
    <td width="32"> </td>
    </tr>
    <tr> 
    <td width="37"> </td>
    <td width="137"> </td>
    <td width="144"> </td>
    <td width="32"> </td>
    </tr>
    </form>
    </table>
    <table width="350" border="0" cellspacing="0" cellpadding="0">
    <tr bgcolor="#666666"> 
    <td> 
    <div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#FFFFFF">S</font></b></font></div>
    </td>
    <td> 
    <div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#FFFFFF">M</font></b></font></div>
    </td>
    <td> 
    <div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#FFFFFF">T</font></b></font></div>
    </td>
    <td> 
    <div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#FFFFFF">W</font></b></font></div>
    </td>
    <td> 
    <div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#FFFFFF">T</font></b></font></div>
    </td>
    <td> 
    <div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#FFFFFF">F</font></b></font></div>
    </td>
    <td> 
    <div align="center"><font face="Arial, Helvetica, sans-serif"><b><font color="#FFFFFF">S</font></b></font></div>
    </td>
    </tr>
    
    
    <% for i = 1 to rows %>
    <tr> 
    <td bgcolor="<%=bgcolor%>"> 
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><%=DayOf%></font></div>
    </td>
    <td bgcolor="<%=bgcolor%>"> 
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><%=DayOf%></font></div>
    </td>
    <td bgcolor="<%=bgcolor%>"> 
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><%=DayOf%></font></div>
    </td>
    <td bgcolor="<%=bgcolor%>"> 
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><%=DayOf%></font></div>
    </td>
    <td bgcolor="<%=bgcolor%>"> 
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><%=DayOf%></font></div>
    </td>
    <td bgcolor="<%=bgcolor%>"> 
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><%=DayOf%></font></div>
    </td>
    <td bgcolor="<%=bgcolor%>"> 
    <div align="center"><font face="Arial, Helvetica, sans-serif" size="2"><%=DayOf%></font></div>
    </td>
    </tr>
    <% next %>
    </table>

		
</body>
</html>