asp分类显示问题?
我需要做这样的一个效果,首先页面要全部显示出里面的所有大类,再根据点击大类传递后的值在该类下面显示出该大类里面的小类,现在的问题是我点击大类,为什么该大类里面的小类均会在...
我需要做这样的一个效果,首先页面要全部显示出里面的所有大类,再根据点击大类传递后的值在该类下面显示出该大类里面的小类,现在的问题是我点击大类,为什么该大类里面的小类均会在出现在所有的大类下面,百思不得其解,下面是代码,寻求高手解答。
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%set rs=server.CreateObject("adodb.recordset")
sql="select * from under where under=0"
rs.open sql,conn,1,1
do while not rs.eof
%>
<a href="?bigclass=<%=rs("id")%>"><%=rs("content")%></a></br>
<%
if request("bigclass")=rs("id") then
set rs2=server.CreateObject("adodb.recordset")
sql2="select * from under where under="& request("bigclass")
rs2.open sql2,conn,1,1
do while not rs2.eof
response.Write rs2("content")&"</br>"
rs2.movenext
loop
rs2.close:set rs2=nothing
%>
<%end if%>
<%
rs.movenext
loop
rs.close:set rs=nothing
%>
</body>
</html> 展开
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>
<body>
<%set rs=server.CreateObject("adodb.recordset")
sql="select * from under where under=0"
rs.open sql,conn,1,1
do while not rs.eof
%>
<a href="?bigclass=<%=rs("id")%>"><%=rs("content")%></a></br>
<%
if request("bigclass")=rs("id") then
set rs2=server.CreateObject("adodb.recordset")
sql2="select * from under where under="& request("bigclass")
rs2.open sql2,conn,1,1
do while not rs2.eof
response.Write rs2("content")&"</br>"
rs2.movenext
loop
rs2.close:set rs2=nothing
%>
<%end if%>
<%
rs.movenext
loop
rs.close:set rs=nothing
%>
</body>
</html> 展开
1个回答
展开全部
<%
dim bigclass'手里没asp环境未测试 有问题hi我
bigclass=request.QueryString("bigclass")
sub ListBigClass()
set rs=server.CreateObject("adodb.recordset")
sql="select * from under where under=0"
rs.open sql,conn,1,1
do while not rs.eof
response.Write "<a href=?bigclass="&rs("id")&" >"&rs("content")&"</a></br>"
rs.movenext
loop
rs.close:set rs=nothing
end sub
function ListSmallClass(bigclassValue)
set rs2=server.CreateObject("adodb.recordset")
sql2="select * from under where under="&bigclassValue
rs2.open sql2,conn,1,1
do while not rs2.eof
ListSmallClass=ListSmallClass&rs2("content")&"</br>"
rs2.movenext
loop
rs2.close:set rs2=nothing
end function
if bigclass="" then
call ListBigClass()
else
response.Write ListSmallClass(bigclass)
end if
%>
dim bigclass'手里没asp环境未测试 有问题hi我
bigclass=request.QueryString("bigclass")
sub ListBigClass()
set rs=server.CreateObject("adodb.recordset")
sql="select * from under where under=0"
rs.open sql,conn,1,1
do while not rs.eof
response.Write "<a href=?bigclass="&rs("id")&" >"&rs("content")&"</a></br>"
rs.movenext
loop
rs.close:set rs=nothing
end sub
function ListSmallClass(bigclassValue)
set rs2=server.CreateObject("adodb.recordset")
sql2="select * from under where under="&bigclassValue
rs2.open sql2,conn,1,1
do while not rs2.eof
ListSmallClass=ListSmallClass&rs2("content")&"</br>"
rs2.movenext
loop
rs2.close:set rs2=nothing
end function
if bigclass="" then
call ListBigClass()
else
response.Write ListSmallClass(bigclass)
end if
%>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询