
ASP中split和if的问题 10
1个题目,跟着4个复选框cd=request.form(a1)/*a1是复选框的名字mystr=split(cd,",")/*因为复选框的值是用,分隔的,4个选项,值分别...
1个题目,跟着4个复选框
cd=request.form(a1) /*a1是复选框的名字
mystr=split(cd,",") /*因为复选框的值是用,分隔的,4个选项,值分别是A B C D
for j=0 to ubound(mystr)
response.write mystr(j)
next
可以正常显示出A B C D
for j=0 to ubound(mystr)
if mystr(j)="A" then
response.write "选择第1项"
else if mystr(j)="B" then
response.write "选择第2项"
else if mystr(j)="C" then
response.write "选择第3项"
else if mystr(j)="D" then
response.write "选择第4项"
end if
end if
end if
end if
next
想实现的是如果选了AB,就显示选择第1项选择第2项
就是选了什么就提出选择了什么
但是 运行时 如果选了ABCD 只能提示选择第1项
如果选了BCD 只能提示选择第2项
其它都无法显示出来
是split使用出了问题,还是if判断语句出了问题 展开
cd=request.form(a1) /*a1是复选框的名字
mystr=split(cd,",") /*因为复选框的值是用,分隔的,4个选项,值分别是A B C D
for j=0 to ubound(mystr)
response.write mystr(j)
next
可以正常显示出A B C D
for j=0 to ubound(mystr)
if mystr(j)="A" then
response.write "选择第1项"
else if mystr(j)="B" then
response.write "选择第2项"
else if mystr(j)="C" then
response.write "选择第3项"
else if mystr(j)="D" then
response.write "选择第4项"
end if
end if
end if
end if
next
想实现的是如果选了AB,就显示选择第1项选择第2项
就是选了什么就提出选择了什么
但是 运行时 如果选了ABCD 只能提示选择第1项
如果选了BCD 只能提示选择第2项
其它都无法显示出来
是split使用出了问题,还是if判断语句出了问题 展开
展开全部
cd=request.form(a1) /*a1是复选框的名字
mystr=split(cd,",") /*因为复选框的值是用,分隔的,4个选项,值分别是A B C D
for j=0 to ubound(mystr)
response.write mystr(j)
next
'可以正常显示出A B C D
'这里加一句
dim mychose
mychose = ""
for j=0 to ubound(mystr)
if mystr(j)="A" then
mychose = mychose & "选择第1项"
end if
if mystr(j)="B" then
mychose = mychose & "选择第2项"
end if
if mystr(j)="C" then
mychose = mychose & "选择第3项"
end if
if mystr(j)="D" then
mychose = mychose & "选择第4项"
end if
next
response.write mychose
mystr=split(cd,",") /*因为复选框的值是用,分隔的,4个选项,值分别是A B C D
for j=0 to ubound(mystr)
response.write mystr(j)
next
'可以正常显示出A B C D
'这里加一句
dim mychose
mychose = ""
for j=0 to ubound(mystr)
if mystr(j)="A" then
mychose = mychose & "选择第1项"
end if
if mystr(j)="B" then
mychose = mychose & "选择第2项"
end if
if mystr(j)="C" then
mychose = mychose & "选择第3项"
end if
if mystr(j)="D" then
mychose = mychose & "选择第4项"
end if
next
response.write mychose
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询