ASP&ASP.NET 캘린더

페이지 정보

작성자 에렐리앙 쪽지보내기 메일보내기 자기소개 아이디로 검색 전체게시물 댓글 0건 조회 1,752회 작성일 12-04-10 13:08

본문


<%
 Dim OnDate, intN, objOpen
 
 OnDate = Request.QueryString("od")
 intN = Request.QueryString("n")
 objOpen = Request.QueryString("o")
%>
<html>
<head>
<title>달력</title>
<script language=javascript>
<!--
window.resizeTo(220,260);
//-->
</script>
</head>
<body>
<%
 Call DrawCalendar(OnDate, intN)
%>
</body>
</html>
<%
 '// OnDate : 달력에서 선택된 일자
 '// intN : OnDate 를 기준으로 이동할 달(월) 수
 Function DrawCalendar(ByVal OnDate, intN)
  Dim WeekdayNames
  Dim Days(42)
  Dim BeginDate, EndDate
  Dim BeginIndex, EndIndex
  Dim i, j, intDay, tempDate
 
  If Not IsDate(OnDate) Then OnDate = FormatDateTime(Date, 2)
  If intN = "" Or Not IsNumeric(intN) Then intN = 0
 
  Select Case intN
   Case 12: OnDate = DateAdd("yyyy", 1, OnDate)
   Case -12: OnDate = DateAdd("yyyy", -1, OnDate)
   Case Else: OnDate = DateAdd("m", intN, OnDate)
  End Select
 
  WeekdayNames = Array("일", "월", "화", "수", "목", "금", "토")
&nbsp; BeginDate = Year(OnDate) & "-" & Month(OnDate) & "-01"
  EndDate = DateAdd("d", -1, DateAdd("m", 1, BeginDate))
 
  BeginIndex = Weekday(BeginDate) - 1
  EndIndex = Day(EndDate) + BeginIndex - 1
 
  '// 배열에 일자값을 저장한다.
  intDay = 1
  For i = BeginIndex To EndIndex
&nbsp;&nbsp; tempDate = Year(OnDate) & "-" & Month(OnDate) & "-" & intDay
&nbsp;&nbsp; Days(i) = "<a href=""javascript:Day_OnClick('" & FormatDateTime(tempDate, 2)&nbsp; & "', '" & WeekdayNames(i Mod 7) & "');"""
   If i Mod 7 = 0 Then
    Days(i) = Days(i) & " class=sunday>"
   ElseIf i Mod 7 = 6 Then
    Days(i) = Days(i) & " class=saturday>"
   Else
    Days(i) = Days(i) & " class=normal>"
   End If
  
   If intDay = Day(OnDate) Then
&nbsp;&nbsp;&nbsp; Days(i) = Days(i) & "<b>" & intDay & "</b>"
   Else
    Days(i) = Days(i) & intDay
   End If
  
   Days(i) = Days(i) & "</a>"
 
   intDay = intDay + 1
  Next
%>
<style type="text/css">
.header { font-size:9pt; }
.normal { font-size:9pt; text-decoration:none; color:black; }
.saturday { font-size:9pt; text-decoration:none; color:blue; }
.sunday { font-size:9pt; text-decoration:none; color:red; }
.selected { font-size:9pt; ; font-weight: bold; text-decoration: none}
.flatBox {  background-color: #EEEEEE; border-color: #CCCCCC #999999 #999999 #CCCCCC; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px}
</style>
 
<script language=javascript>
<!--
function Day_OnClick(SelectedDate, sDayName)
{
 var f = eval("opener.document.<%=objOpen%>");
 f.value = SelectedDate + ' ' + sDayName + '요일';
 opener.focus();
 window.close();
}
 
function goMonth(n)
{
 document.location = "DrawCalendar.asp?o=<%=objOpen%>&od=<%=OnDate%>&n=" + n;
}
//-->
</script>
<table border=0 cellspacing=1 cellpadding=5 width=190 align=center ID="Table1">
 <tr>
  <td align=center class=normal>
   <input type="button" name="Button" value="<<" class="flatBox" onclick="goMonth(-12);" ID="Button1"><input type="button" name="Button2" value="<" class="flatBox" onclick="goMonth(-1);" ID="Button2">
   <b><%=Year(OnDate)%>년 <%=Month(OnDate)%>월</b>
   <input type="button" name="Button3" value=">" class="flatBox" onclick="goMonth(1);" ID="Button3"><input type="button" name="Button4" value=">>" class="flatBox" onclick="goMonth(12);" ID="Button4">
  </td>
 </tr>
</table>
<table border="0" cellspacing="1" cellpadding="3" bgcolor="#333333" ID="Table2" align=center width=190>
 <tr align="center" bgcolor="#666666">
  <td width="20" class="header"  height=25><font color="#FFFFFF">일</font></td>
  <td width="20" class="header"><font color="#FFFFFF">월</font></td>
  <td width="20" class="header"><font color="#FFFFFF">화</font></td>
  <td width="20" class="header"><font color="#FFFFFF">수</font></td>
  <td width="20" class="header"><font color="#FFFFFF">목</font></td>
  <td width="20" class="header"><font color="#FFFFFF">금</font></td>
  <td width="20" class="header"><font color="#FFFFFF">토</font></td>
 </tr>
 <% For i = 0 To 5 %>
 <tr align="center" bgcolor="#FFFFFF">
  <% For j = 0 To 6 %>
  <td height="20" class="normal"><%=Days(i*7+j)%></td>
  <% Next %>
 </tr>
 <%
&nbsp; If i = 4 And Days(35) & "" = "" Then
   Exit For
  End If
 %>
 <% Next %>
</table>
<% 
 End Function
%>

답변목록

등록된 답변이 없습니다.

Total 0건 1 페이지
게시물 검색
번호 제목 글쓴이 조회 날짜
게시물이 없습니다.