主题:  表单验证的问题!再线等!

天落鸟

职务:普通成员
等级:1
金币:0.0
发贴:51
注册:2002/3/21 17:38:13
#12004/6/14 16:07:01

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="Vbscript">
    sub checkt()
        if (document.form1.TskName.value="") then
             MsgBox"请输入任务名称."
                document.form1.TskName.focus()
                exit sub
        
            elseif (document.form1.Content.value)="" then
                    
                    MsgBox"请输入任务内容。"
                    document.form1.Content.focus()
                    exit sub
            
            elseif(document.form1.runtime.value<>"") then
                if not isdate(document.form1.runtime.value) then
                    MsgBox"请输入开始执行时间格式不正确,请重新输入。"
                    document.form1.runtime.focus()
                    exit sub
                end if
        end if
                    form1.submit()
    end sub
</script>

<body>
<form name="form1" method="post" action="cc.asp">
<input type="text" name="TskName" value="<%=request("TskName")%>">
<input type="text" name="Content" value="<%=request("Content")%>">
<input type="text" name="runtime" value="<%=request("runtime")%>">
<input type="submit" name="Submit" value="提交" onClick="checkt()">
</form>
</body>
</html>
验证成功后还会跳转到CC.asp的页面上!



缺缺

职务:管理员
等级:8
金币:41.0
发贴:9620
注册:2004/1/14 19:14:47
#22004/6/14 16:23:13
<input type="button" name="Submit" value="提交" onClick="checkt()">



天落鸟

职务:普通成员
等级:1
金币:0.0
发贴:51
注册:2002/3/21 17:38:13
#32004/6/14 16:31:10
一样的效果啊1大哥!



缺缺

职务:管理员
等级:8
金币:41.0
发贴:9620
注册:2004/1/14 19:14:47
#42004/6/14 16:41:12
验证成功当然会提交表单到cc.asp,否则你想怎样?



帅哥村党委专职副书记

职务:普通成员
等级:2
金币:3.0
发贴:373
注册:2002/10/16 11:35:57
#52004/6/14 16:43:48
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="Vbscript">
sub checkt()
if (document.form1.TskName.value="") then
MsgBox"请输入任务名称."
document.form1.TskName.focus()
exit sub

elseif (document.form1.Content.value)="" then

MsgBox"请输入任务内容。"
document.form1.Content.focus()
exit sub

elseif(document.form1.runtime.value<>"") then
if not isdate(document.form1.runtime.value) then
MsgBox"请输入开始执行时间格式不正确,请重新输入。"
document.form1.runtime.focus()
exit sub
end if
end if
form1.submit()
end sub
</script>

<body>
<form name="form1" method="post" action="cc.asp">
<input type="text" name="TskName" value="<%=request("TskName")%>">
<input type="text" name="Content" value="<%=request("Content")%>">
<input type="text" name="runtime" value="<%=request("runtime")%>">
<input type="button" name="Submit" value="提交" onClick="checkt()">
</form>
</body>
</html>