欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

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

程序员文章站 2022-05-16 09:41:25
dateselect. 创立一个日历格式的。。。<%@ language="vbscript" %> <% code written by d. scott ha...
dateselect. 创立一个日历格式的。。。

<%@ language="vbscript" %>
<%
code written by d. scott hand
if any errors are found, please
e-mail scott_hand@pobox.com with
the error and the way the error
was caused
***purpose:************
* this is a page built to show calendar functionality.
* description:
* this is the instantiated file toto
* allow the user to select a date.
***********************
if request.querystring("page") <> "" then
   pagename = request.querystring("page")
   session("pagename") = pagename
else
   pagename = session("pagename")
end if
if request.querystring("form") <> "" then
   formname = request.querystring("form")
   session("formname") = formname
else
   formname = session("formname")
end if
if request.querystring("element") <> "" then
   elementname = request.querystring("element")
   session("elementname") = elementname
else
   elementname = session("elementname")
end if
%>
<html>
<head>
<meta name="generator" content="microsoft visual interdev 1.0">
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<title>select date</title>
</head>
<body bgcolor="#ded6c5" alink="#526b84" vlink="#526b84" onblur="javascript:self . focus ();">
<script language="javascript">
   function calpopulate(dte) {
   window.opener.<%=formname & "." & elementname%>.value = dte;
   self.close()
      }
</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)
%>
<center>
<table>
<tr>
<td colspan="7" align="center">
<hr>
<font size=2><b><%=monthname(currentmonth)%>&nbsp;<%=year(builddate)%></b>
<br>

<%
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
%>
<a href="dateselect.asp?bmonth=<%=previousmonth%>"><font