验证的问题

zhuifengxiaozi 2004-09-21 10:13:10
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>例---验证</title>
</head>
<script language="VBScript">
sub check()
if frm1.user.value=empty then
msgbox "请输入您的留言昵称!"

exit sub
end if

frm1.submit
end sub

end sub
</script>
<body>
<form name="form1" method="post" action="">
<p align="center" lang="af"> </p>

<table width="60%" border="0" align="center">
<tbody>
<tr>
<td colspan="2"><p align="center">
<font color="#0066CC"><strong><font size="+2">用户验证</font></strong></font>
<p> </p></td>
</tr>
<tr>
<td width="19%"><font color="#3399FF">姓名:</font></td>
<td width="81%"><font color="#3399FF">
<input type="text" name="user">
</font></td>
</tr>
<tr>
<td><font color="#3399FF">性别:</font></td>
<td> <font color="#3399FF">
<input id="male" type="radio" name="male" value="1" checked="checked" />

<input id="formale" type="radio" name="formale" value="0" />
女</td>
</tr>
<tr>
<td height="20"><font color="#3399FF">年龄:</font></td>
<td><font color="#3399FF">
<input type="text" name="age">
</font></td>
</tr>
<tr>
<td height="20"><font color="#3399FF">就业去向:</font></td>
<td> <font color="#3399FF">
<select name="select">
<option value="学生">学生</option>
<option value="工作">工作</option>
<option value="生意">生意</option>
<option value="房地产">房地产</option>
<option value="国营">国营</option>
</select>
</font></td>
</tr>
<tr>
<td height="27" colspan="2" align="center"> <font color="#3399FF">
<input name=B1 type=submit value=" 提 交 " onclick="check">
      
<input name=B2 type=reset value=" 重写 ">
</font>
</td>
</tr>
</tbody>
</table>

</form>

</body>
</html>

问题在于VBScript这里我想单击提交后姓名的VALUE为空就显示MSGBOX

但是现在这个验证根本不起作用

请帮忙,谢谢!!

还有我想在加一个控制姓名的文本不超过10个字符的验证


<script language="VBScript">
sub check()
if frm1.user.value=empty then
这里该如何写呢???
exit su b
end if

frm1.submit
end sub

end sub
</script>
...全文
83 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
babyboyren 2004-09-21
  • 打赏
  • 举报
回复
点帖子上面的管理就好了
zhuifengxiaozi 2004-09-21
  • 打赏
  • 举报
回复
二为在吗

我还想问一下 怎么结帖 ??
我有好几个 还没有 结
会影响 我的
信誉的 再说大家也不能白白帮我呀
heibing 2004-09-21
  • 打赏
  • 举报
回复
同意楼上
zltostem 2004-09-21
  • 打赏
  • 举报
回复
<script language="VBScript">
sub check()
if document.all.user.value="" then
msgbox "姓名不能为空!"
exit sub
else
if len(trim(document.all.user.value)) > 10 then
msgbox "姓名不能超过10位!"
exit sub
end if
end if

frm1.submit()
end sub
</script>
everywhen 2004-09-21
  • 打赏
  • 举报
回复
<script language="VBScript">
sub check()
if frm1.user.value="" then
msgbox("asdf")
exit sub
end if
if len(frm1.user.value) > 10 then
msgbox("asdf")
exit sub
end if
frm1.submit
end sub
</script>

28,404

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧