标题:[求助]关于身高的表单验证
只看楼主
bgelan
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2004-11-2
 问题点数:0 回复次数:2 
[求助]关于身高的表单验证

我的表单中要验证身高的数据,首先必须是数字,其次身高只能在140-220之间.用下面的代码只能实现前面的功能,请高手帮我看看,祝新春快乐!

if height<>"" then
if not ((height>="0" and height<="9") ) then
response.redirect "error.asp?info=对不起,身高必须是数字,请重新输入!"
else
height=int(height)
end if
end if
if height<>"" then
height=int(height)
if (height >220 and height <140) then
response.Redirect "error.aso?info=对不起,您输入的身高有误,请重新输入!"
end if
end if

2006-02-01 22:01
redmangame
Rank: 1
等 级:新手上路
帖 子:49
专家分:0
注 册:2004-8-23
得分:0 
判断所填数据是数字型

if not isNumeric(request("字段名称")) then
response.write "不是数字"
else
response.write "数字"
end if


我是菜鸟
2006-02-01 23:09
bgelan
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2004-11-2
得分:0 
if height<>"" then
if not ((height>="0" and height<="9") ) then
response.redirect "error.asp?info=对不起,身高必须是数字,请重新输入!"
elseif not (height<=70 and height>=220) then
response.Redirect "error.asp?info=对不起,您输入的身高有误,请重新输入!"
else
height=int(height)
end if
end if
2006-02-01 23:50



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-44316-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.017201 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved