高手请看

slyer 2006-05-18 10:17:32
<script language="VBScript" type="text/VBScript">
sub button1_onclick()
if trim(form1.nickname.value)="" or trim(form1.pwd.value)="" or trim(form1.pwd2.value)="" or trim(form1.email.value)="" or

trim(form1.area2.value)="" then
msgbox"标记*的项不能为空"
else
cha=trim(form1.nickname.value)
chalen=len(cha)
if chalen<3 or chalen>20 then
msgbox"用户名必须3—20位" :exit sub
for i=1 to chalen
ascii=asc(Mid(cha,i,1))
if not(ascii>=asc("A") and ascii<=asc("Z") or ascii>=asc("a") and ascii<=asc("z") or

ascii>=asc("0") and ascii<=asc("9")) then
MsgBox "用户名必须由数字和字母组成":exit sub

end if
next
document.form1.submit
end if
end if
end sub
</script>

为什么我在文本框中输入汉字没有错误信息提示?
...全文
161 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ruanjiantaotao 2006-05-23
  • 打赏
  • 举报
回复
改成 if (not(ascii>=asc("A") and ascii<=asc("Z")) or (ascii>=asc("a") and ascii<=asc("z")) or (ascii>=asc("0") and ascii<=asc("9"))
Little_qd 2006-05-23
  • 打赏
  • 举报
回复
来了:) if里的and用括号括一下?
nb_user 2006-05-21
  • 打赏
  • 举报
回复
请教各位高手一个问题:

<body>
<form action="savedata.ASP" method="POST" name="addgq" LANGUAGE="javascript" onsubmit="return FrmAddLink_onsubmit()">
<script language = JScript>
dict = new Array();
dict.zg = "中国";
function login() {
if(dict[xmname.value])
monkey.value = dict[xmname.value];
}
</script>
<input type=text name="xmname" value="ZG">  <input type=text name="monkey" onkeyup="login()" value=""></form>

以上代码,我研究了挺长时间,由于本人能力有限实在研究不出来,请高手指教!
如果把第二行“<form action="addgq-savedata.ASP" method="POST" name="addgq" LANGUAGE="javascript" onsubmit="return FrmAddLink_onsubmit()">”拿掉的话,就能正确使用,但我不明白,为什么加上"<form action="addgq-savedata.ASP" method="POST" name="addgq" LANGUAGE="javascript" onsubmit="return FrmAddLink_onsubmit()">"之后就不能用了,请大家研究一下!在此感激不尽!在等急等!
slyer 2006-05-21
  • 打赏
  • 举报
回复
怎么没人解答?高手都去休假了?
slyer 2006-05-21
  • 打赏
  • 举报
回复
怎么没人回答呢?
liangweifeng2008 2006-05-19
  • 打赏
  • 举报
回复
公司网站,有空,给参考一下!谢谢
www.xxzl.cn
mtvsky 2006-05-19
  • 打赏
  • 举报
回复
不会,路过留名。
是是非非 2006-05-19
  • 打赏
  • 举报
回复
不用这么麻烦,用正则表达式把

28,391

社区成员

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

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