ASP几个常用的判断函数
来源:互联网 发布:怎么样看淘宝店铺公司 编辑:程序博客网 时间:2024/04/28 11:07
在取得用户输入信息的时候,我们常常要判断用户输入的有效性.
下面几个是常用的 :
1,检查输入字段是否为日期类型
function xdate(inputdate)
if not is date(inputdate) then
xdate=0
elseif
cdate(inputdate)>date then
xdate=0
else
xdate=1
end if
end function
2.邮政编码
funciton xzip(inputzip)
if isnumeric(inputzip) then
if len(inputzip)=6 then
xzip=1
else
xzip=0
end if
else
xzip=0
end if
end function
3.电子邮件
function xemail(inputemail)
theat=instr(2,inputemail,"@")
if theat=0 then
xemail=0
else
thedot=instr(cint(theat)+2,inputemail,".")
if thedot=0 then
xemail=0
elseif cint(thedot)+1>len(inputemail)
then
xmail=0
else
xmail=1
end if
end if
end function
1,先写脚本,用if else 判断代码的有效性,
然后将错误消息给一个变量。
2,用该变量的值来决定网页的流向和输出。
还有一种方法是将网页的提交按扭设为button。
onclick 属性 触发子程序。(写成子程序)
判断一个数是奇数还是偶数?
function Is_odd(num) as boolean
n=num mod 2
if n=1 then
Is_odd=true
else
Is_odd=false
end if
end function
是奇数返回真,是偶数返回假。
下面几个是常用的 :
1,检查输入字段是否为日期类型
function xdate(inputdate)
if not is date(inputdate) then
xdate=0
elseif
cdate(inputdate)>date then
xdate=0
else
xdate=1
end if
end function
2.邮政编码
funciton xzip(inputzip)
if isnumeric(inputzip) then
if len(inputzip)=6 then
xzip=1
else
xzip=0
end if
else
xzip=0
end if
end function
3.电子邮件
function xemail(inputemail)
theat=instr(2,inputemail,"@")
if theat=0 then
xemail=0
else
thedot=instr(cint(theat)+2,inputemail,".")
if thedot=0 then
xemail=0
elseif cint(thedot)+1>len(inputemail)
then
xmail=0
else
xmail=1
end if
end if
end function
1,先写脚本,用if else 判断代码的有效性,
然后将错误消息给一个变量。
2,用该变量的值来决定网页的流向和输出。
还有一种方法是将网页的提交按扭设为button。
onclick 属性 触发子程序。(写成子程序)
判断一个数是奇数还是偶数?
function Is_odd(num) as boolean
n=num mod 2
if n=1 then
Is_odd=true
else
Is_odd=false
end if
end function
是奇数返回真,是偶数返回假。
- ASP几个常用的判断函数
- 安卓判断网络状态的几个常用函数
- 常用ASP+VBSCRIPT判断函数
- 几个常用的函数
- 常用的几个函数
- 几个ASP通用的函数
- 几个常用的日期函数
- 几个常用的日期函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 几个常用的Javascript函数
- 不玩Blog,改玩Wiki了
- MS SQL Server2000全文索引image列全攻略
- 理解Windows消息机制[ZZ]
- zip、unzip工具类
- You receive a C4226 or a C4236 error message when you compile code to contain the keyword in 32-bit Visual C++(ZZ)
- ASP几个常用的判断函数
- 通过触发器实现数据库的即时同步
- 根据当月数据库自动生成下个月数据库
- 如果获得客户端的分辨率
- 判断日期的正则 考虑了闰年
- 译文:JSF Framework Services
- 网络 运动 快乐
- WEB程序的执行过程!
- 神经病