注册 | 登录 | 设为首页 | 加入收藏
您当前的位置:飞翔学院-IT中国 → 编程开发Asp → 文章内容

在ASP控制数字及字母输入

作者:IT 来源:不详 发布时间:2007-9-1 22:29:57
最近常有朋友问我如何在ASP中象在JavaScrip里一样控制输入的值只能是英文或数字,现在我整理如下,下面我以接收变量string的值讲解如下:



方法一:
str=Request("string")
temp=Server.URLEncode(str)
if str=temp then
  response.write "你输入的不是英文或数字"
end if



文法二:
str=Request("string")
for i=1 to len(str)
   a=mid(string,i,1)
   if ((asc(a)<"0" and asc(a)>"9" ) or (asc(a)<asc("a") and asc(a)>asc("z"))) then
  response.write "你输入的不是英文或数字"
 end if
next i

http://www.itcnw.com/
  • 打印文档
  • 推荐好友
  • 返回顶部
  • 增大字体
  • 减少字体
关于本站 | 工作机会 | 合作网站 | 广告服务 | 市场合作| 联系我们 | 抽奖活动
版权所有: 武汉威俊科技有限公司 Copyright 2005-2007 www.ITCNW.COM All rights reserved