<%
Option Explicit
Dim strDate
' 记录输入的日期,字符型.
Dim datDate
' 测试输入的日期是否正确,日期型.
<html>
%>
<head>
<title>千花飞舞之日期验证</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="https://www.jb51.net/Css/export.css" type="text/css">
</head>
<body text="#000000">
<Form ACTION="<% = Request.ServerVariables("script_NAME") %>" METHOD="POST">
<table cellpadding="0" cellspacing="0">
<tr>
<td background="../Pic/br.jpg">
<table cellpadding="4" cellspacing="4">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2">
<div>请输入所要查询的日期:
<input type="text" value="<% = Cstr(Year(Now())) & "-" & Cstr(Month(Now()))
& "-" & Cstr(Day(Now()))%>" size="10" maxlength="10">
</div>
</td>
</tr>
<tr>
<td>
<div>
<input type="submit" value="确认">
</div>
</td>
<td>
<div>
<input type="reset" value="取消">
</div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</Form>
<%
strDate = Request.Form("strDate")
If strDate <> "" Then
On Error Resume Next
datDate = CDate(strDate)
If Err.Number = 0 Then
%>
<Script Language="javascript">
<!--
InputDate.action="TypeAlert.asp"
InputDate.submit()
//-->
</Script>
<%
Else
%>
<Script Language="javascript">
<!--
alert ("噢,您输入的日期错啦,请重新输入!")
//-->
</Script>
<%
End If
End If
%>
</body></html>
[1]
您可能感兴趣的文章: