All source code in ASP/ VbScript Ask a ASP/ VbScript Pro Discussion Forum Categories All jobs in ASP/ VbScript
Quick Search for:  in language:    
Displays,dynamic,calendar,html,using
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
ASP/ VbScript Stats

 Code: 281,486. lines
 Jobs: 101. postings

 How to support the site

 
Sponsored by:

 
You are in:
 
Login

NEW! LEARNING CENTER
Special educational offers, white papers, webcasts, podcasts

  NEW! Download Rational Performance Tester V8 (download now)
  NEW! Download Rational Functional Tester V8 (download now)
  NEW! Download Rational Service Tester for SOA Quality V8 (download now)
  NEW! Teleconference: Quality In Action - Using Rational Quality Manager with Functional, Performance and Web Service Testing Products (download now)
  NEW! Introducing IBM Rational AppScan Developer Edition – easing security testing by non-security professionals (download now)

 

 


Latest postings for ASP/ VbScript.
Click here to see a screenshot of this code!Mess Officer Management System (Sistem Pengurusan Mess Pegawai)
By Mohd Fauzi on 11/23

(Screen Shot)

Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!



 
 
   

Complete ASP Calendar

Print
Email
 
VB icon
Submitted on: 5/17/2001 9:23:18 AM
By: Matt Pantana 
Level: Intermediate
User Rating: By 4 Users
Compatibility:ASP (Active Server Pages), HTML, VbScript (browser/client side)

Users have accessed this code 30467 times.
 
 
     Displays a dynamic calendar in html using asp

 
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!

    '**************************************
    ' for :Complete ASP Calendar
    '**************************************
    none: distribute freely
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

    '**************************************
    ' Name: Complete ASP Calendar
    ' Description:Displays a dynamic calenda
    '     r in html using asp
    ' By: Matt Pantana
    '
    ' Inputs:You can input the month or the 
    '     year, but neither is required
    '
    ' Returns:a calendar
    '
    ' Assumes:Just copy and paste the whole 
    '     thing
    '
    'This code is copyrighted and has    ' limited warranties.Please see http://w
    '     ww.Planet-Source-Code.com/vb/scripts/Sho
    '     wCode.asp?txtCodeId=6668&lngWId=4    'for details.    '**************************************
    
    <%
    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)
    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, tmonth & "/01/" & 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
    %>
    <HTML>
    <HEAD>
    <TITLE>Calendar</TITLE>
    <META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <META HTTP-EQUIV="Pragma" CONTENT="no-cache">
    <SCRIPT language="VBScript">
    Sub cmonth_onchange
    frm.submit
    End Sub
    Sub cyear_onchange
    frm.submit
    End Sub
    </SCRIPT>
    </HEAD>
    <BODY bgcolor="#FFFFFF" text="#000000">
    <TABLE width="350" border="0" cellspacing="0" cellpadding="0">
    <FORM name=frm method=get action=calendar.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>

 
 Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
5/19/2001 10:56:32 AMLewis Moten

Simple yet elligant. You may want to consider making the client side script into javascript.
(If this comment was disrespectful, please report it.)

 
5/23/2001 1:20:38 PMJeff Katz

Is there a way to add custom dates?
(If this comment was disrespectful, please report it.)

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author from the email account you registered on the site, so you can correspond directly.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
To post feedback, first please login.


 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | ASP/ VbScript Home | Site Home | Other Sites | Open Letter from Moderators | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997-2008 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.   Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.