asp if可以输出 select case不行 10
求高手解答代码如下:selectcaserequest("action")case"addnav":callnavaddendselectsubnavaddiftrim(...
求高手解答
代码如下:
select case request("action")
case "addnav" : call navadd
end select
sub navadd
if trim(request("title"))<>"" or trim(request("title"))<>"菜单名称" then
set rs1=server.createobject("adodb.recordset")
rs1.open "select * from navsort",conn,3,3
if trim(request("leve"))<>"" or tirm(request("leve"))<>"==请选择菜单级别==" then
if request("leve")=1 then
if request("s1")<>"" or request("s1")<>"==请选择一级菜单==" or request("s2")<>"" or request("s2")<>"==请选择二级菜单==" then
alertmsgboxgo "对不起,菜单级别与菜单选项不符\n\n请认真填写,级别1不能选择下拉菜单\n\n级别2可选择所属的一级菜单做子菜单\n\n级别3可选择所属的一级菜单下的二级菜单做子菜单","-1"
else
rs1.addnew
rs1("sortleve1")=request("leve")
rs1("sortname")=request("title")
end if
end if
if request("leve")=2 then
if request("s2")<>"" or request("s2")<>"==请选择二级菜单==" then
alertmsgboxgo "对不起,菜单级别与菜单选项不符\n\n请认真填写,级别1不能选择下拉菜单\n\n级别2可选择所属的一级菜单做子菜单\n\n级别3可选择所属的一级菜单下的二级菜单做子菜单","-1"
elseif request("s1")<>"" or request("s1")<>"==请选择一级菜单==" then
rs1("topsortid")=request("s1")
rs1("sortleve1")=request("leve")
rs1("sortname")=request("title")
else
alertmsgboxgo "对不起,一级菜单不能为空!!!\n\n请认真填写谢谢!!!","-1"
end if
end if
if request("leve")=3 then
if request("s2")<>"" or request("s2")<>"==请选择二级菜单==" or request("s1")<>"" or request("s1")<>"==请选择一级菜单==" then
rs1("topsortid")=request("s1")
rs1("parentid")=request("s2")
rs1("sortleve1")=request("leve")
rs1("sortname")=request("title")
else
alertmsgboxgo "对不起,一级、二级菜单不能为空!!!\n\n请认真填写谢谢!!!","-1"
end if
end if
else
rs1("sortleve1")=1
rs1("sortname")=request("title")
end if
rs1.update
rs1.close
set rs1=nothing
else
alertmsgboxgo "请输入菜单名称\n\n级别菜单请在下拉框中选择\n\n顶级菜单请直接提交\n\n谢谢!!!","-1"
end if
set rs2=server.createobject("adodb.recordset")
rs2.open "select * from navsort where sortname='"&tirm("title")&"'",conn,1,3
if rs2("parentid")<>"" or rs2("topsortid")<>"" then
rs2("sortstatus")=true
else
rs2("parentid")=rs2("id")
rs2("topsortid")=rs2("id")
end if
if rs2("id")=rs2("topsortid") and rs2("topsortid")=rs2("parentid") then
rs2("sortpath")=rs2("id")
elseif rs2("topsortid")=rs2("parentid") then
rs2("sortpath")=rs2("topsortid")&","&rs2("id")
else
rs2("sortpath")=rs2("topsortid")&","&rs2("parentid")&","&rs2("id")
end if
rs2.update
rs2.close
set rs2=nothing
end sub 展开
代码如下:
select case request("action")
case "addnav" : call navadd
end select
sub navadd
if trim(request("title"))<>"" or trim(request("title"))<>"菜单名称" then
set rs1=server.createobject("adodb.recordset")
rs1.open "select * from navsort",conn,3,3
if trim(request("leve"))<>"" or tirm(request("leve"))<>"==请选择菜单级别==" then
if request("leve")=1 then
if request("s1")<>"" or request("s1")<>"==请选择一级菜单==" or request("s2")<>"" or request("s2")<>"==请选择二级菜单==" then
alertmsgboxgo "对不起,菜单级别与菜单选项不符\n\n请认真填写,级别1不能选择下拉菜单\n\n级别2可选择所属的一级菜单做子菜单\n\n级别3可选择所属的一级菜单下的二级菜单做子菜单","-1"
else
rs1.addnew
rs1("sortleve1")=request("leve")
rs1("sortname")=request("title")
end if
end if
if request("leve")=2 then
if request("s2")<>"" or request("s2")<>"==请选择二级菜单==" then
alertmsgboxgo "对不起,菜单级别与菜单选项不符\n\n请认真填写,级别1不能选择下拉菜单\n\n级别2可选择所属的一级菜单做子菜单\n\n级别3可选择所属的一级菜单下的二级菜单做子菜单","-1"
elseif request("s1")<>"" or request("s1")<>"==请选择一级菜单==" then
rs1("topsortid")=request("s1")
rs1("sortleve1")=request("leve")
rs1("sortname")=request("title")
else
alertmsgboxgo "对不起,一级菜单不能为空!!!\n\n请认真填写谢谢!!!","-1"
end if
end if
if request("leve")=3 then
if request("s2")<>"" or request("s2")<>"==请选择二级菜单==" or request("s1")<>"" or request("s1")<>"==请选择一级菜单==" then
rs1("topsortid")=request("s1")
rs1("parentid")=request("s2")
rs1("sortleve1")=request("leve")
rs1("sortname")=request("title")
else
alertmsgboxgo "对不起,一级、二级菜单不能为空!!!\n\n请认真填写谢谢!!!","-1"
end if
end if
else
rs1("sortleve1")=1
rs1("sortname")=request("title")
end if
rs1.update
rs1.close
set rs1=nothing
else
alertmsgboxgo "请输入菜单名称\n\n级别菜单请在下拉框中选择\n\n顶级菜单请直接提交\n\n谢谢!!!","-1"
end if
set rs2=server.createobject("adodb.recordset")
rs2.open "select * from navsort where sortname='"&tirm("title")&"'",conn,1,3
if rs2("parentid")<>"" or rs2("topsortid")<>"" then
rs2("sortstatus")=true
else
rs2("parentid")=rs2("id")
rs2("topsortid")=rs2("id")
end if
if rs2("id")=rs2("topsortid") and rs2("topsortid")=rs2("parentid") then
rs2("sortpath")=rs2("id")
elseif rs2("topsortid")=rs2("parentid") then
rs2("sortpath")=rs2("topsortid")&","&rs2("id")
else
rs2("sortpath")=rs2("topsortid")&","&rs2("parentid")&","&rs2("id")
end if
rs2.update
rs2.close
set rs2=nothing
end sub 展开
2个回答
展开全部
select case request("action")
case "addnav"
call navadd
end select
中间为何有个冒号:,用不着的
一般select case 都用在选项较多的情况下,如:
select case request("action")
case "a"
call a
case "b"
call b
end select
条件少的判断,直接用 if then end if
if request("action")= "addnav"
then call navadd
end if
就这样可以了
case "addnav"
call navadd
end select
中间为何有个冒号:,用不着的
一般select case 都用在选项较多的情况下,如:
select case request("action")
case "a"
call a
case "b"
call b
end select
条件少的判断,直接用 if then end if
if request("action")= "addnav"
then call navadd
end if
就这样可以了
更多追问追答
追问
我试过不行
条件很多 我只不过是提取一段不行的来提问
能否帮我解答一下
追答
a = request("action")
select case a
case "a"
call a
case "b"
call b
end select
先赋值,再试试。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询