level 1
kakac9527
楼主
姓名不能为空,不超过10字符。
年龄只能为数字,必须大于10.
这是我编的,哪错了?
<html>
<script language="vbscript">
sub button1_onclick()
dim theform
set theform=document.validform
if theform.name.value="" or len(document.theform.name.value)>10
msgbox"姓名不能为空且最多为五个汉字!"
exit sub
end if
if isnumeric(theform.age.value) then
if theform.age.value<=10
msgbox"请在年龄框中输入一个大于10的数字!"
else
msgbox"验证通过,请按键提交!"
end if
else
msgbox"请在年龄框输入数字!"
end if
theform.submit
end sub
</script>
</head>
<body>
<form name="validform" method="post" action="if.html">
<p>
<label>姓名:
<input name="nmae" type="text" id="nmae" />
</label>
</p>
<p>
<label>年龄:
<input name="age" type="text" id="age" />
</label>
</p>
<p>
<input type="button" name="button1" value="提交" onc />
</p>
</form>
</body>
</html>
2009年09月29日 09点09分
1
年龄只能为数字,必须大于10.
这是我编的,哪错了?
<html>
<script language="vbscript">
sub button1_onclick()
dim theform
set theform=document.validform
if theform.name.value="" or len(document.theform.name.value)>10
msgbox"姓名不能为空且最多为五个汉字!"
exit sub
end if
if isnumeric(theform.age.value) then
if theform.age.value<=10
msgbox"请在年龄框中输入一个大于10的数字!"
else
msgbox"验证通过,请按键提交!"
end if
else
msgbox"请在年龄框输入数字!"
end if
theform.submit
end sub
</script>
</head>
<body>
<form name="validform" method="post" action="if.html">
<p>
<label>姓名:
<input name="nmae" type="text" id="nmae" />
</label>
</p>
<p>
<label>年龄:
<input name="age" type="text" id="age" />
</label>
</p>
<p>
<input type="button" name="button1" value="提交" onc />
</p>
</form>
</body>
</html>