<P><스타일>td { 글꼴 계열: 宋体; 글꼴 크기:9pt}</style><body bgcolor=eeeeee><table width=180 cellpadding=0cellspacing=1 bgcolor=dddddd align=center><% '다음은 ASP에서 이 달력 알고리즘으로 구현된 특정 코드입니다.</P><P> '먼저 연도와 월이 지정되어 있는지 확인하고, 그렇지 않은 경우 현재 연도와 월을 기준으로 If를 표시합니다. Request(ReqDate)= then CurrentDate=Dateelse CurrentDate=Trim(Request(ReqDate))end ifpyear=year(CurrentDate)pmonth=month(CurrentDate)</P><P> '다음 코드는 달력 표시를 위한 테이블 헤더 내용을 생성합니다. % > <tr align=LEFT bgcolor=#dddddd> <td 너비=14% 높이=19 align=center> <입력 유형=버튼 value=<< onclick=JavaScript:location.href='?ReqDate=<%=DateAdd(m,-1,CurrentDate) %>'></td> <td colspan=5 align=center> <%=pyear% >연도<%=pmonth%>월</td> <td width=14% align=center> <입력 유형=버튼 값=>> onclick=JavaScript:location.href='?ReqDate=<%=DateAdd(m,1,CurrentDate)%>'></td> </tr> <tr align=center bgcolor=#CCCCCC> <td width=14 % height=19> 일</td> <td width=14%> 하나</td> <td width=14%> 둘</td> <td width=14%> 셋</td> <td width=14%> 넷</td> <td width=14%> 다섯</td> <td width=14%> 여섯</td> </tr> <tr align=center bgcolor=ffffff 높이=19> <% 'ASP에는 지정된 달의 일수를 구하는 함수가 없으므로 이를 구하려면 다른 알고리즘을 사용해야 합니다. 알고리즘은 실제로 매우 간단합니다. 즉, 1일부터 1일까지의 총 일수를 계산하는 것입니다. 표시할 월과 다음 달 1일 fromDate = FormatDateTime(월(현재 날짜) & /1/ & 연도(현재 날짜))toDate = FormatDateTime(DateAdd(m,1,fromDate))'표시할 달의 첫 번째 날이 nun일 때 요일을 구합니다.monthstart=weekday(fromDate)-1'표시할 첫 번째 날 사이의 총 일수를 구합니다. 표시 및 다음 달 1일( 해당 월의 일수)nunmonthend=DateDiff(d,fromDate,toDate)' 달력을 표시하는 데 사용해야 하는 테이블 행 수 결정(각 행은 7일을 표시함) ) 만약에 nunmonthstart+nunmonthend<36 then maxi=36else maxi=43end if' 루프를 생성하여 테이블을 생성하고 i=1do를 표시하는 동안 i<maxi iv=i-nunmonthstart if i>nunmonthstart 및 i<=nunmonthend+nunmonthstart then '표시되는 내용이 있으면 is today 그런 다음 iv=Day(now) 및 Month(now)=pmonth 및 year(now)=pyear이면 빨간색 배경으로 표시하고 response.write( <td align=center bgcolor=ffaaaa><a href='#' target=_blank> & iv & </a></td>) else response.write( <td align=center><a href='#' target= _blank> & iv & </a></td>) end if else response.write( <td> </td>) end if</P><P> '7로 나눌 수 있는 경우(한 줄에 7 표시), i mod 7=0이면 개행을 출력하고 response.write( </tr><tr align=center bgcolor=ffffff height=19>) end if i=i +1loop%></table></body>