这个asp的代码哪里错了?放到网页会出错
我的外貌:<%FunctionParseLove(rs,sex)Dimloves,result,comma,currcurr=""result=""comma=""lov...
我的外貌:
<%
Function ParseLove(rs,sex)
Dim loves,result,comma,curr
curr = ""
result = ""
comma = ""
loves = split(rs, ", ")
For i=Lbound(loves) To Ubound(loves)
select case loves(i)
if sex = 1 or sex = "1" then
case "1"
curr = "英俊"
case "2"
curr = "帅气"
case "3"
curr = "健壮"
case else
curr = "帅"
else
case "1"
curr = "美丽"
case "2"
curr = "纯洁"
case "3"
curr = "妩媚"
case else
curr = "可爱"
end if
End Select
result = result & comma & curr
comma = ","
Next
ParseLove = result
End Function
If rs("sex") = 1 or rs("sex") = "1" then
Response.Write(ParseLove(rs("manface"),rs("sex")))
else
Response.Write(ParseLove(rs("womanface"),rs("sex")))
end if
%>
字段manface , womanface 分别是注册的时候提交上来的复选项 1,2,3,4
单独调出一个性别的时候正常。
现在就是加了这个if sex =1 else的判断就出错了,这个判断的代码有问题
2楼的代码放上去,结果
Microsoft VBScript 编译器错误 错误 '800a0400'
缺少语句
/user.asp,行 552
case "1"
^ 展开
<%
Function ParseLove(rs,sex)
Dim loves,result,comma,curr
curr = ""
result = ""
comma = ""
loves = split(rs, ", ")
For i=Lbound(loves) To Ubound(loves)
select case loves(i)
if sex = 1 or sex = "1" then
case "1"
curr = "英俊"
case "2"
curr = "帅气"
case "3"
curr = "健壮"
case else
curr = "帅"
else
case "1"
curr = "美丽"
case "2"
curr = "纯洁"
case "3"
curr = "妩媚"
case else
curr = "可爱"
end if
End Select
result = result & comma & curr
comma = ","
Next
ParseLove = result
End Function
If rs("sex") = 1 or rs("sex") = "1" then
Response.Write(ParseLove(rs("manface"),rs("sex")))
else
Response.Write(ParseLove(rs("womanface"),rs("sex")))
end if
%>
字段manface , womanface 分别是注册的时候提交上来的复选项 1,2,3,4
单独调出一个性别的时候正常。
现在就是加了这个if sex =1 else的判断就出错了,这个判断的代码有问题
2楼的代码放上去,结果
Microsoft VBScript 编译器错误 错误 '800a0400'
缺少语句
/user.asp,行 552
case "1"
^ 展开
4个回答
展开全部
<%
Function ParseLove(rs,sex)
Dim loves,result,comma,curr
curr = ""
result = ""
comma = ""
loves = split(rs, ", ")
For i=Lbound(loves) To Ubound(loves)
if sex = 1 or sex = "1" then
select case loves(i)
case "1"
curr = "英俊"
case "2"
curr = "帅气"
case "3"
curr = "健壮"
case else
curr = "帅"
End Select
else
select case loves(i)
case "1"
curr = "美丽"
case "2"
curr = "纯洁"
case "3"
curr = "妩媚"
case else
curr = "可爱"
End Select
end if
result = result & comma & curr
comma = ","
Next
ParseLove = result
End Function
rs=1
sex="1"
If rs = 1 or sex = "1" then
Response.Write(ParseLove(1,1))
else
Response.Write(ParseLove(2,2))
end if
%>
先不调用数据库直接测试,正确,看看读出的值是什么。response。write(“《script》alert('"&rs("值")&"')《/sciprt>”)
Function ParseLove(rs,sex)
Dim loves,result,comma,curr
curr = ""
result = ""
comma = ""
loves = split(rs, ", ")
For i=Lbound(loves) To Ubound(loves)
if sex = 1 or sex = "1" then
select case loves(i)
case "1"
curr = "英俊"
case "2"
curr = "帅气"
case "3"
curr = "健壮"
case else
curr = "帅"
End Select
else
select case loves(i)
case "1"
curr = "美丽"
case "2"
curr = "纯洁"
case "3"
curr = "妩媚"
case else
curr = "可爱"
End Select
end if
result = result & comma & curr
comma = ","
Next
ParseLove = result
End Function
rs=1
sex="1"
If rs = 1 or sex = "1" then
Response.Write(ParseLove(1,1))
else
Response.Write(ParseLove(2,2))
end if
%>
先不调用数据库直接测试,正确,看看读出的值是什么。response。write(“《script》alert('"&rs("值")&"')《/sciprt>”)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
Function ParseLove(rs,sex)
Dim loves,result,comma,curr
curr = ""
result = ""
comma = ""
loves = split(rs, ", ")
For i=Lbound(loves) To Ubound(loves)
if sex = 1 or sex = "1" then
select case loves(i)
case "1"
curr = "英俊"
case "2"
curr = "帅气"
case "3"
curr = "健壮"
case else
curr = "帅"
End Select
else
select case loves(i)
case "1"
curr = "美丽"
case "2"
curr = "纯洁"
case "3"
curr = "妩媚"
case else
curr = "可爱"
End Select
end if
result = result & comma & curr
comma = ","
Next
ParseLove = result
End Function
If rs("sex") = 1 or rs("sex") = "1" then
Response.Write(ParseLove(rs("manface"),rs("sex")))
else
Response.Write(ParseLove(rs("womanface"),rs("sex")))
end if
%>
Function ParseLove(rs,sex)
Dim loves,result,comma,curr
curr = ""
result = ""
comma = ""
loves = split(rs, ", ")
For i=Lbound(loves) To Ubound(loves)
if sex = 1 or sex = "1" then
select case loves(i)
case "1"
curr = "英俊"
case "2"
curr = "帅气"
case "3"
curr = "健壮"
case else
curr = "帅"
End Select
else
select case loves(i)
case "1"
curr = "美丽"
case "2"
curr = "纯洁"
case "3"
curr = "妩媚"
case else
curr = "可爱"
End Select
end if
result = result & comma & curr
comma = ","
Next
ParseLove = result
End Function
If rs("sex") = 1 or rs("sex") = "1" then
Response.Write(ParseLove(rs("manface"),rs("sex")))
else
Response.Write(ParseLove(rs("womanface"),rs("sex")))
end if
%>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%
Function ParseLove(rs,sex)
Dim loves,result,comma,curr
curr = ""
result = ""
comma = ""
loves = split(rs, ", ")
For i=Lbound(loves) To Ubound(loves)
if sex = 1 or sex = "1" then
select case loves(i)
case "1"
curr = "英俊"
case "2"
curr = "帅气"
case "3"
curr = "健壮"
case else
curr = "帅"
End Select
else
select case loves(i)
case "1"
curr = "美丽"
case "2"
curr = "纯洁"
case "3"
curr = "妩媚"
case else
curr = "可爱"
End Select
end if
result = result & comma & curr
comma = ","
Next
ParseLove = result
End Function
rs=1
sex="1"
If rs = 1 or sex = "1" then
Response.Write(ParseLove(1,1))
else
Response.Write(ParseLove(2,2))
end if
%>
Function ParseLove(rs,sex)
Dim loves,result,comma,curr
curr = ""
result = ""
comma = ""
loves = split(rs, ", ")
For i=Lbound(loves) To Ubound(loves)
if sex = 1 or sex = "1" then
select case loves(i)
case "1"
curr = "英俊"
case "2"
curr = "帅气"
case "3"
curr = "健壮"
case else
curr = "帅"
End Select
else
select case loves(i)
case "1"
curr = "美丽"
case "2"
curr = "纯洁"
case "3"
curr = "妩媚"
case else
curr = "可爱"
End Select
end if
result = result & comma & curr
comma = ","
Next
ParseLove = result
End Function
rs=1
sex="1"
If rs = 1 or sex = "1" then
Response.Write(ParseLove(1,1))
else
Response.Write(ParseLove(2,2))
end if
%>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
select 语句不能套 if
select case loves(1)
case "1"
case "2"
end select
select case loves(1)
case "1"
case "2"
end select
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询