DateSelect.asp 创立一个日历格式的。。。
1@ LANGUAGE="VBSCRIPT"
1
2'Code Written by D. Scott Hand
3'If any errors are found, please
4'e-mail [email protected] with
5'the error and the way the error
6'was caused
7'***Purpose:************
8'* This is a page built to show calendar functionality.
9'* Description:
10'* This is the instantiated file toto
11'* allow the user to select a date.
12'***********************
13If Request.Querystring("Page") <> "" Then
14PageName = Request.Querystring("Page")
15Session("PageName") = PageName
16Else
17PageName = Session("PageName")
18End If
19If Request.Querystring("Form") <> "" Then
20FormName = Request.Querystring("Form")
21Session("FormName") = FormName
22Else
23FormName = Session("FormName")
24End If
25If Request.Querystring("Element") <> "" Then
26ElementName = Request.Querystring("Element")
27Session("ElementName") = ElementName
28Else
29ElementName = Session("ElementName")
30End If
1<html>
2<head>
3<meta content="Microsoft Visual InterDev 1.0" name="GENERATOR"/>
4<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
5<title>Select Date</title>
6</head>
7<body alink="#526B84" bgcolor="#ded6c5" onblur="javascript:self . focus ();" vlink="#526B84">
8<script language="javascript">
9function calpopulate(dte) {
10window.opener.```
11=formname & "." & elementname
12```.value = dte;
13self.close()
14}
15</script>
If IsDate(Request.QueryString("Date")) Then
BuildDate=Request.QueryString("Date")
Else
If Request.Querystring("BMonth") = "" Then
BMonth = Month(Now)
Else
BMonth = Request.Querystring("BMonth")
End If
If Request.QueryString("BYear") <> "" Then
BuildDate = BMonth & "/" & "1" & "/" & _
Request.QueryString("BYear")
Else
BuildDate = BMonth & "/" & "1" & "/" & Right(Year(Now), 2)
End If
End If
Session("CurrentDate")=BuildDate
'This gives the position of weekday for that date
BuildDayValue = Weekday(BuildDate)
CurrentMonth = Month(BuildDate)
1<center>
2<table>
3<tr>
4<td align="center" colspan="7">
5<hr/>
6<font size="2"><b>```
7=MonthName(CurrentMonth)
8``` ```
9=Year(BuildDate)
10```</b>
11<br/>
12
'BuildDate=DateAdd("d", -1, BuildDate)
If CurrentMonth < 12 then
NextMonth=CurrentMonth+1 & "&BYear=" & Year(BuildDate)
Else
NextMonth="1&BYear=" & Year(DateAdd ("yyyy", 1, BuildDate))
End if
If CurrentMonth > 1 then
PreviousMonth=CurrentMonth-1 & "&BYear=" & Year(BuildDate)
Else
PreviousMonth= "12&BYear=" & Year(DateAdd ("yyyy", -1, BuildDate))
End If
1<a href="DateSelect.asp?BMonth=```
2=PreviousMonth
3```"><font size="-2"><\--Previous</font></a>
4
5<a href="DateSelect.asp?BMonth=```
6=NextMonth
7```"><font size="-2">Next--></font></a>
8<hr/></font></td>
9</tr>
10<tr>
11<td><font size="-3">Su</font></td><td><font size="-3">Mo</font></td><td><font size="-3">Tu</font></td><td><font size="-3">We</font></td><td><font size="-3">Th</font></td><td><font size="-3">Fr</font></td><td><font size="-3">Sa</font></td>
12</tr>
13<tr>
14<tr>
DayPosition=1
'Now loop through table build with blanks until first day of month
'is in position
For I = 1 to BuildDayValue-1
1<td><font size="-3"> </font></td>
DayPosition=DayPosition+1
Next
Do Until CurrentMonth <> Month(BuildDate)
1
While DayPosition<>8
1<td "="" "bgcolor="" #ffffff"""="" &="" (builddate),2)="" ```="" ```')"="" align="center" calpopulate('"="" day(builddate)="" if="" month(builddate)="" onclick="```
2Response.Write " response.write="" right(year="" then=""><font size="-3">
3<a href="">```
4=Day(BuildDate)
5```</a>
6</font></td>
DayPosition=DayPosition+1
BuildDate=DateAdd("d", 1, BuildDate)
If CurrentMonth <> Month(BuildDate) then
DayPosition=8
End If
Wend
DayPosition=1
1
2</tr><tr>
Loop
1</tr>
2</tr></table>
3</center>
4</body>
5</html>