一个问题 ̄高手请进 ̄ ̄

lfaye 2003-07-08 08:23:19
比如我在文本框输入一个8个字符(数字或英文),假设是2002089a,然后提交,那么我在接收的页面如何得到如果第五、六个字是01的话,pstate='冬天',是02的话就pstate='夏天'.....08就是...等等。这样如何实现啊?
...全文
28 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
tanyaliji 2003-07-09
  • 打赏
  • 举报
回复
同意
select case Mid(request.Form("文本框名"),5,2)
case "01" pstate='冬天'
case "02" pstate='夏天'
............
end select

也可

if

else if
...........
else if
...........
else if
..........
else if
..........
end if

亦可

zykj_2000 2003-07-09
  • 打赏
  • 举报
回复
严重同意用
select case Mid(request.Form("文本框名"),5,2)
case "01" pstate='冬天'
case "02" pstate='夏天'
............
end select

但是
if instr("2002019a","01")=5 then
这并不是指第5个字 而是在位置5的有同有存在01
renniliao 2003-07-09
  • 打赏
  • 举报
回复
同意
select case Mid(request.Form("文本框名"),5,2)
case "01" pstate='冬天'
case "02" pstate='夏天'
............
end select
但是substring是不行的。它是SQL中的函数,不能在页面中使用。
woochy 2003-07-09
  • 打赏
  • 举报
回复
这个好,就是它了,你还想什么

select case Mid(request.Form("文本框名"),5,2)
case "01" pstate='冬天'
case "02" pstate='夏天'
............
end select
lfaye 2003-07-08
  • 打赏
  • 举报
回复
if instr("2002019a","01")=5 then
这句不是指第五个字吗?如果我是要第五和第六个字呢?
rxxm 2003-07-08
  • 打赏
  • 举报
回复
同意楼上二位意见
hfkj 2003-07-08
  • 打赏
  • 举报
回复
<%
Response.Write instr("2002019a","01")
if instr("2002019a","01")=5 then
response.write "冬天"
end if
%>
hfkj 2003-07-08
  • 打赏
  • 举报
回复
<%
Response.Write instr("2002019a","01")
if instr("2002019a","01")=5 then
response.write "冬天"
end if
%>
801190629 2003-07-08
  • 打赏
  • 举报
回复
同意
select case Mid(request.Form("文本框名"),5,2)
case "01" pstate='冬天'
case "02" pstate='夏天'
............
end select
Oliverzhong 2003-07-08
  • 打赏
  • 举报
回复
SUBSTRING(expression, start, length)
比如你的substring(expression,5,2)就可
colee 2003-07-08
  • 打赏
  • 举报
回复
select case Mid(request.Form("文本框名"),5,2)
case "01" pstate='冬天'
case "02" pstate='夏天'
............
end select
funboy88 2003-07-08
  • 打赏
  • 举报
回复
<%
Response.Write instr("2002019a","01")
if instr("2002019a","01")=5 then
response.write "冬天"
end if
%>

28,391

社区成员

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

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