主题:  如何判断文本框内里的内容大小

laohu1980

职务:普通成员
等级:1
金币:0.0
发贴:20
注册:2003/3/1 13:32:09
#12003/3/1 19:44:47
我作了个表单,想在客户端判断表单内文本框里的内容是否大于上限,比如24K,请问高手们,用VBSCRIPT应该怎么写,谢谢



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
注册:2002/7/25 21:24:11
#22003/3/1 21:07:50
textmax=最大字节
if text <> "" and Len(text)> textmax then
 出错页面
end if

编辑历史:[这消息被行者编辑过(编辑时间2003-03-01 21:09:24)]


laohu1980

职务:普通成员
等级:1
金币:0.0
发贴:20
注册:2003/3/1 13:32:09
#32003/3/3 10:20:09
可现在是这样的,十个字母他判断是10,十个汉字他判断也是10,请问怎么处理



{ 在指尖上绽放的花朵 }

职务:普通成员
等级:5
金币:14.0
发贴:3209
注册:2002/7/25 21:24:11
#42003/3/3 19:43:10
sigh~ 写个复杂些的吧……

text=Request.Form("text")
text=Trim(text)
txtlen=0
txtmax=最大字节

for i=1 to len(text)
if asc(mid(text,i,1))<0 then
txtlen=txtlen+2
else
txtlen=txtlen+1
end if
next
if txtlen>txtmax then
 出错页面
end if

喔~ 仿佛又回到了多年前,用qb摆忙的年龄……



laohu1980

职务:普通成员
等级:1
金币:0.0
发贴:20
注册:2003/3/1 13:32:09
#52003/3/4 8:46:53
不复杂挺好,谢谢