%
Option Explicit
Dim strDate
' 記錄輸入的日期,字符型.
Dim datDate
' 測試輸入的日期是否正確,日期型.
html>
%>
head>
title>千花飛舞之日期驗(yàn)證/title>
meta http-equiv="Content-Type" content="text/html; charset=gb2312">
link rel="stylesheet" href="../Css/export.css" type="text/css">
/head>
body text="#000000">
Form name="InputDate" ACTION="% = Request.ServerVariables("script_NAME") %>" METHOD="POST">
table width="500" border="1" cellpadding="0" cellspacing="0" align="center">
tr>
td background="../Pic/br.jpg">
table width="500" border="0" cellpadding="4" cellspacing="4" class="9p">
tr>
td colspan="2">nbsp;/td>
/tr>
tr>
td colspan="2" height="60">
div align="center">請輸入所要查詢的日期:
input type="text" name="strDate" value="% = Cstr(Year(Now())) "-" Cstr(Month(Now()))
"-" Cstr(Day(Now()))%>" size="10" maxlength="10">
/div>
/td>
/tr>
tr>
td width="50%">
div align="center">
input type="submit" name="Submit" value="確認(rèn)">
/div>
/td>
td>
div align="center">
input type="reset" name="Submit2" 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]
標(biāo)簽:威海 襄陽 邯鄲 朔州 柳州 雞西 中山 遵義
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《如何驗(yàn)證日期輸入是否正確?》,本文關(guān)鍵詞 如何,驗(yàn)證,日期,輸入,是否,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。