一个提供用户输入时期的绝好程序之(二)

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 &amp; "." &amp; 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") &lt;&gt; "" Then
BuildDate = BMonth &amp; "/" &amp; "1" &amp; "/" &amp; _
Request.QueryString("BYear")
Else
BuildDate = BMonth &amp; "/" &amp; "1" &amp; "/" &amp; 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 &lt; 12 then
NextMonth=CurrentMonth+1 &amp; "&amp;BYear=" &amp; Year(BuildDate)
Else
NextMonth="1&amp;BYear=" &amp; Year(DateAdd ("yyyy", 1, BuildDate))
End if

If CurrentMonth &gt; 1 then
PreviousMonth=CurrentMonth-1 &amp; "&amp;BYear=" &amp; Year(BuildDate)
Else
PreviousMonth= "12&amp;BYear=" &amp; Year(DateAdd ("yyyy", -1, BuildDate))
End If

 1<a href="DateSelect.asp?BMonth=```
 2=PreviousMonth
 3```"><font size="-2">&lt;\--Previous</font></a>   
 4      
 5<a href="DateSelect.asp?BMonth=```
 6=NextMonth
 7```"><font size="-2">Next--&gt;</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 &lt;&gt; Month(BuildDate)

1  

While DayPosition&lt;&gt;8

1<td "="" "bgcolor="" #ffffff"""="" &="" (builddate),2)="" ```="" ```')"="" align="center" calpopulate('"="" day(builddate)="" if="" month(builddate)="" onclick="```
2Response.Write " response.write="" right(year="" then=""&gt;&lt;font size="-3"&gt;
3&lt;a href=""&gt;```
4=Day(BuildDate)
5```&lt;/a&gt;
6&lt;/font&gt;&lt;/td&gt;   

DayPosition=DayPosition+1
BuildDate=DateAdd("d", 1, BuildDate)
If CurrentMonth <> Month(BuildDate) then
DayPosition=8
End If
Wend
DayPosition=1

1  
2&lt;/tr&gt;&lt;tr&gt;   

Loop

1&lt;/tr&gt;
2&lt;/tr&gt;&lt;/table&gt;
3&lt;/center&gt;
4&lt;/body&gt;
5&lt;/html&gt;
Published At
Categories with Web编程
Tagged with
comments powered by Disqus