ASP Shopping Cart
,
Forum
&
BBS
- all for $20 from
CodeToad Plus!
Home
||
ASP
|
ASP.Net
|
C++/C#
|
DHTML
|
HTML
|
Java
|
Javascript
|
Perl
|
VB
|
XML
||
CodeToad Plus!
||
Forums
||
RAM
Search Site:
Home
»
ASP
» Article
ASP Tree Calendar
Article by:
Glen (7/23/2002)
Add to Favourites
Tell a friend
Summary:
A tree-style calender allowing the user to easily select any day of the year.
Viewed:
43598
times
Rating (11 votes):
3.7
out of 5
Rate this Article
Read Comments
Post Comments
Written by
Glen
from
Cool ASP Stuff
View Live Demo
Download Script & Images
.
A tree-style calender script allowing the user to easily select any day of the year.
Select All Code
<% Function NumDays(dtSelected) '******* Function accepts a date and returns the number of days in a month datetime = dateadd("d", -datepart("d",dtSelected)+1,dtSelected) datetime = dateadd("m", 1, datetime) datetime = dateadd("d", -1, datetime) NumDays = datepart("d",datetime) end function Function daySuff( byVal intDay ) '******** Accepts a day of the month as an integer and returns the appropriate suffix Dim strOrd Select Case intDay Case 1, 21, 31 strOrd = "st" Case 2, 22 strOrd = "nd" Case 3, 23 strOrd = "rd" Case Else strOrd = "th" End Select daySuff = strOrd End Function ' daySuff %>
Tree Calendar View
<% Sub DrawCalendar (numYears,blnBackWards) '***************************************************** '* * '* Procedure accepts number of years 0 = Current * '* blnBackWards = whether to go back in years or not * '* * '***************************************************** 'The folding list items markup strheadel1 = "
" strheadel2 = "
" strfoldlist2 = "
" 'check to see if we are starting from a negative value if blnBackWards then startYear = -Cint(numYears) else startYear = 0 end if for k = startYear to (numYears) dtyear = year(dateadd("yyyy",k,date)) response.write strheadel1 &dtyear &strheadel2 response.write strfoldlist2 for i = 1 to 12 dtdate = dateserial(dtyear,i,1) strdate = month(i) intdays = numdays(dtdate) response.write strheadel1 &monthname(datepart("m",dtdate)) &strheadel2 response.write strfoldlist2 for j = 1 to intdays response.write "
" response.write weekdayname(weekday(dtDate))&" - " response.write monthname(datepart("m",dtdate)) &" " response.write j &daySuff(j) &"
" dtDate = dateAdd("d",1,dtDate) next response.write "
" next response.write "" next end Sub intDraw = Request.Form("YEARS") Select case intDraw Case "0" DrawCalendar 0,FALSE Case "1" DrawCalendar 4,FALSE Case "2" DrawCalendar 4,TRUE Case "3" DrawCalendar 7,TRUE Case Else DrawCalendar 2,FALSE End Select %>
Current Year (DrawCalendar 0,FALSE)
From 2001-2005 (DrawCalendar 4,FALSE)
From 1997-2005 (DrawCalendar 4,TRUE)
From 1994-2008 (DrawCalendar 7,TRUE)
Source Code