ASP产品分类
<linkhref="images/index.css"rel="stylesheet"type="text/css"><%sql1="select*fromclasso...
<link href="images/index.css" rel="stylesheet" type="text/css">
<%
sql1=" select * from class order by id "
Set rs1=Server.CreateObject("ADODB.RecordSet")
rs1.open sql1,conn,1,1
if rs1.eof then
response.write "?μí3?D?1??óD2ú?··?ààD??¢£?"
else
Do while not rs1.eof
%>
<table width="190" height="31" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#F0F0F0">
<td width="35" height="35">
<div align="center"></div></td>
<td>·<span class="STYLE3"><a href="product.asp?classid=<%=rs1("id")%>"><%=rs1("classname")%></a></span></td>
</tr>
<tr>
<td height="1" colspan="2" background="images/x1.gif"></td>
</tr>
</table>
<%
sql2=" select * from nclass where classid="&rs1("id")&" order by id "
Set rs2=Server.CreateObject("ADODB.RecordSet")
rs2.open sql2,conn,1,1
if rs2.eof then
else
Do while not rs2.eof
%>
<table width="190" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" colspan="2"><div align="right"> </div></td>
<td width="142" class="font112"><a href="product.asp?classid=<%=rs1("id")%>&nclassid=<%=rs2("id")%>"><%=rs2("nclassname")%></a> </td>
</tr>
<tr>
<td width="22" height="1"></td>
<td colspan="2" background="images/x1.gif"></td>
</tr>
</table>
<%
rs2.MoveNext
i=i+1
Loop
rs2.close
set rs2=nothing
end if
rs1.MoveNext
i=i+1
Loop
end if
rs1.close
set rs1=nothing
%>
——————————————————————
因为一级分类太多,所以无法全部展示二级分类
请高手帮助一下
如果修改成 点一个一级分类才显示该大分类下的二级分类 点第二个大分类后 第一个分类内的二级分类自动关闭(修改后的完整代码) 展开
<%
sql1=" select * from class order by id "
Set rs1=Server.CreateObject("ADODB.RecordSet")
rs1.open sql1,conn,1,1
if rs1.eof then
response.write "?μí3?D?1??óD2ú?··?ààD??¢£?"
else
Do while not rs1.eof
%>
<table width="190" height="31" border="0" cellpadding="0" cellspacing="0">
<tr bgcolor="#F0F0F0">
<td width="35" height="35">
<div align="center"></div></td>
<td>·<span class="STYLE3"><a href="product.asp?classid=<%=rs1("id")%>"><%=rs1("classname")%></a></span></td>
</tr>
<tr>
<td height="1" colspan="2" background="images/x1.gif"></td>
</tr>
</table>
<%
sql2=" select * from nclass where classid="&rs1("id")&" order by id "
Set rs2=Server.CreateObject("ADODB.RecordSet")
rs2.open sql2,conn,1,1
if rs2.eof then
else
Do while not rs2.eof
%>
<table width="190" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" colspan="2"><div align="right"> </div></td>
<td width="142" class="font112"><a href="product.asp?classid=<%=rs1("id")%>&nclassid=<%=rs2("id")%>"><%=rs2("nclassname")%></a> </td>
</tr>
<tr>
<td width="22" height="1"></td>
<td colspan="2" background="images/x1.gif"></td>
</tr>
</table>
<%
rs2.MoveNext
i=i+1
Loop
rs2.close
set rs2=nothing
end if
rs1.MoveNext
i=i+1
Loop
end if
rs1.close
set rs1=nothing
%>
——————————————————————
因为一级分类太多,所以无法全部展示二级分类
请高手帮助一下
如果修改成 点一个一级分类才显示该大分类下的二级分类 点第二个大分类后 第一个分类内的二级分类自动关闭(修改后的完整代码) 展开
1个回答
展开全部
<%
set rs=server.createobject("adodb.recordset")
rs.open "select * from [class] order by id desc",conn,1,1 '对产品类目表进行循环
if not rs.eof then
i=1
response.write "<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""margin-top:5px;"">"& vbCrLf
do while not rs.eof
if i>=2 then '当i>2时隐藏产品
stys="none"
else '小于时显示
stys=""
end if
response.write "<Tr height=24><td onClick=""showsubmenu("&i&")"">"&rs("classname")&"</tD></tr>"& vbCrLf
set rss=server.createobject("adodb.recordset")
rss.open "select * from [nclass] where classid="&rs("id")&" order by id desc",conn,1,1
if not rss.eof then
response.write "<tr><Td style=""display:"&stys&""" id='submenu"&i&"'><table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""margin-top:5px;"">"& vbCrLf
do while not rss.eof '对所对应产品类目表中的产品进行循环
response.write "<Tr height=24><td>·<a href='product.asp?classid="&rss("id")&"&nclassid="&rs("id")&"'>"&rss("nclassname")&"</a></tD></tr>"& vbCrLf
rss.movenext
loop
else
response.write "<Tr height=24><td>对不起,此栏目下暂无类别!</td></tr>"& vbCrLf
end if
rss.close
set rss=nothing
response.write "</table></td></tr>"
i=i+1
rs.movenext
loop
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "</table>"
%>
<SCRIPT language=javascript1.2>
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
}
}
</SCRIPT>
set rs=server.createobject("adodb.recordset")
rs.open "select * from [class] order by id desc",conn,1,1 '对产品类目表进行循环
if not rs.eof then
i=1
response.write "<table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""margin-top:5px;"">"& vbCrLf
do while not rs.eof
if i>=2 then '当i>2时隐藏产品
stys="none"
else '小于时显示
stys=""
end if
response.write "<Tr height=24><td onClick=""showsubmenu("&i&")"">"&rs("classname")&"</tD></tr>"& vbCrLf
set rss=server.createobject("adodb.recordset")
rss.open "select * from [nclass] where classid="&rs("id")&" order by id desc",conn,1,1
if not rss.eof then
response.write "<tr><Td style=""display:"&stys&""" id='submenu"&i&"'><table width=""100%"" border=""0"" cellpadding=""0"" cellspacing=""0"" style=""margin-top:5px;"">"& vbCrLf
do while not rss.eof '对所对应产品类目表中的产品进行循环
response.write "<Tr height=24><td>·<a href='product.asp?classid="&rss("id")&"&nclassid="&rs("id")&"'>"&rss("nclassname")&"</a></tD></tr>"& vbCrLf
rss.movenext
loop
else
response.write "<Tr height=24><td>对不起,此栏目下暂无类别!</td></tr>"& vbCrLf
end if
rss.close
set rss=nothing
response.write "</table></td></tr>"
i=i+1
rs.movenext
loop
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "</table>"
%>
<SCRIPT language=javascript1.2>
function showsubmenu(sid)
{
whichEl = eval("submenu" + sid);
if (whichEl.style.display == "none")
{
eval("submenu" + sid + ".style.display=\"\";");
}
else
{
eval("submenu" + sid + ".style.display=\"none\";");
}
}
</SCRIPT>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询