Asp关于二级分类的写法??
在网站搜到一段产品目录二级分类写法.但是Crtl+V过去以后发现二级分类是竖首的.可不可以横着写..现在产品的二级分类就是竖着的.我想改成.就像多数网站的产品显示那样.把...
在网站搜到一段产品目录二级分类写法.但是Crtl+V过去以后发现二级分类是竖首的.可不可以横着写..现在产品的二级分类就是竖着的.我想改成.就像多数网站的产品显示那样.把二级分类横着放.一行三个这样子.源代码如果.谢谢了.解决问题加分
<table width="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200"></td>
</tr>
<tr>
<td valign="top">
<%
Set rsproducts=server.CreateObject ("Adodb.recordset")
sql="select * from products where flang=1 and ID=0"
rsproducts.open sql,conn,1,1
count = 0
do while not rsproducts.eof
productsID =trim(rsproducts("productsID"))
productseID =trim(rsproducts("productseID"))
productsName =trim(rsproducts("productsName"))
productsPic =trim(rsproducts("productsPic"))
%>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="200" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td height="30"> <%=productsName%> </td>
</tr>
</tbody>
</table>
<br /></td>
</tr>
<tr>
<td valign="top">
<%
Set rs=server.CreateObject ("Adodb.recordset")
sql="select * from products where productseID="&productsID&""
rs.open sql,conn,1,1
do while not rs.eof
LproductsID =trim(rs("productsID"))
LproductseID =trim(rs("productseID"))
LproductsName =trim(rs("productsName"))
LproductsPic =trim(rs("productsPic"))
%>
<table width="94%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#f5f5f5" class="gray">
<tr valign="top" align="middle">
<td width="10"bgcolor="ffffff"><img src="/images/tou.gif" width="24" height="24" /></td>
<td height="20" valign="top" bgcolor="ffffff"><a href="small.asp?productsID=<%=LproductsID%>&bar=<%=productsID%>"><%=LproductsName%></a></td>
</tr>
</table>
<br />
<%
rs.movenext
loop
rs.close
set rs=nothing
%></td>
</tr>
</table>
<br /></td>
</tr>
</tbody>
</table>
<%
count=count+1
rsproducts.movenext
loop
rsproducts.close
set rsproducts=nothing
conn.close
set conn=nothing
%>
<br /></td>
</tr>
</table>
恩.对对.就是这样子.不过这个是横着一排全过来了啊.我现在第一个产品有10个分类的话.左边这边就多了好多出来.不协调了.我的意思是能不能控制住有三个二级分类的时候就自动另换一行显示.
感谢:yangshunyu6288 不过提示说:错误类型:
Microsoft VBScript 编译器错误 (0x800A0400)
缺少语句
left.asp, line 112
end if 展开
<table width="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200"></td>
</tr>
<tr>
<td valign="top">
<%
Set rsproducts=server.CreateObject ("Adodb.recordset")
sql="select * from products where flang=1 and ID=0"
rsproducts.open sql,conn,1,1
count = 0
do while not rsproducts.eof
productsID =trim(rsproducts("productsID"))
productseID =trim(rsproducts("productseID"))
productsName =trim(rsproducts("productsName"))
productsPic =trim(rsproducts("productsPic"))
%>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="200" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td height="30"> <%=productsName%> </td>
</tr>
</tbody>
</table>
<br /></td>
</tr>
<tr>
<td valign="top">
<%
Set rs=server.CreateObject ("Adodb.recordset")
sql="select * from products where productseID="&productsID&""
rs.open sql,conn,1,1
do while not rs.eof
LproductsID =trim(rs("productsID"))
LproductseID =trim(rs("productseID"))
LproductsName =trim(rs("productsName"))
LproductsPic =trim(rs("productsPic"))
%>
<table width="94%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#f5f5f5" class="gray">
<tr valign="top" align="middle">
<td width="10"bgcolor="ffffff"><img src="/images/tou.gif" width="24" height="24" /></td>
<td height="20" valign="top" bgcolor="ffffff"><a href="small.asp?productsID=<%=LproductsID%>&bar=<%=productsID%>"><%=LproductsName%></a></td>
</tr>
</table>
<br />
<%
rs.movenext
loop
rs.close
set rs=nothing
%></td>
</tr>
</table>
<br /></td>
</tr>
</tbody>
</table>
<%
count=count+1
rsproducts.movenext
loop
rsproducts.close
set rsproducts=nothing
conn.close
set conn=nothing
%>
<br /></td>
</tr>
</table>
恩.对对.就是这样子.不过这个是横着一排全过来了啊.我现在第一个产品有10个分类的话.左边这边就多了好多出来.不协调了.我的意思是能不能控制住有三个二级分类的时候就自动另换一行显示.
感谢:yangshunyu6288 不过提示说:错误类型:
Microsoft VBScript 编译器错误 (0x800A0400)
缺少语句
left.asp, line 112
end if 展开
展开全部
这是各非常简单的问题,不过由于懒得建数据库我没有调试;这给展示产品一样的,每行显示多少列,自动换行;
<table width="497" border="0" cellpadding="0" cellspacing="0">
<%
Set rsproducts=server.CreateObject ("Adodb.recordset")
sql="select * from products where flang=1 and ID=0"
rsproducts.open sql,conn,1,1
count = 0
while not rsproducts.eof
productsID =trim(rsproducts("productsID"))
productseID =trim(rsproducts("productseID"))
productsName =trim(rsproducts("productsName"))
productsPic =trim(rsproducts("productsPic"))
%>
<tr>
<td height="30" colspan="2" align="left"><%=productsName%></td>
</tr>
<tr>
<td width="40" height="30"> </td>
<td width="360" align="left">
<table border="0" cellspacing="0" cellpadding="0">
<!--关键就在这里,先根据小类别的总数和要显示的列数(如3列)来得到行数,在来循环行数,依次输出小类-->
<%
Set rs=server.CreateObject ("Adodb.recordset")
sql="select * from products where productseID="&productsID&""
rs.open sql,conn,1,1
if not rs.eof then
LproductsID =trim(rs("productsID"))
LproductseID =trim(rs("productseID"))
LproductsName =trim(rs("productsName"))
LproductsPic =trim(rs("productsPic"))
allnum=rs.recordcount
lie=3 '定义小类要显示的列数,随便你想要多少列都可以
row=int(-1*rs.recordcount/lie)*(-1) '得到总共要显示的行数
num=0
for j=1 to row
%>
<tr>
<%for i=1 to lie%>
<td width="10" ><img src="/images/tou.gif" width="24" height="24" /></td>
<td height="20" width="100" align="left"><a href="small.asp?productsID=<%=LproductsID%>&bar=<%=productsID%>"><%=LproductsName%></a></td>
<% num=num+1
if num=allnum then exit for
rs.moveNext
if rs.eof then exit for
next%>
</tr>
<%
if num=allnum then exit for
if rs.eof then exit for
next
end if
rs.close%>
%>
</table></td>
</tr>
<%
rsproducts.movenext
wend
rsproducts.close
%>
</table>
<table width="497" border="0" cellpadding="0" cellspacing="0">
<%
Set rsproducts=server.CreateObject ("Adodb.recordset")
sql="select * from products where flang=1 and ID=0"
rsproducts.open sql,conn,1,1
count = 0
while not rsproducts.eof
productsID =trim(rsproducts("productsID"))
productseID =trim(rsproducts("productseID"))
productsName =trim(rsproducts("productsName"))
productsPic =trim(rsproducts("productsPic"))
%>
<tr>
<td height="30" colspan="2" align="left"><%=productsName%></td>
</tr>
<tr>
<td width="40" height="30"> </td>
<td width="360" align="left">
<table border="0" cellspacing="0" cellpadding="0">
<!--关键就在这里,先根据小类别的总数和要显示的列数(如3列)来得到行数,在来循环行数,依次输出小类-->
<%
Set rs=server.CreateObject ("Adodb.recordset")
sql="select * from products where productseID="&productsID&""
rs.open sql,conn,1,1
if not rs.eof then
LproductsID =trim(rs("productsID"))
LproductseID =trim(rs("productseID"))
LproductsName =trim(rs("productsName"))
LproductsPic =trim(rs("productsPic"))
allnum=rs.recordcount
lie=3 '定义小类要显示的列数,随便你想要多少列都可以
row=int(-1*rs.recordcount/lie)*(-1) '得到总共要显示的行数
num=0
for j=1 to row
%>
<tr>
<%for i=1 to lie%>
<td width="10" ><img src="/images/tou.gif" width="24" height="24" /></td>
<td height="20" width="100" align="left"><a href="small.asp?productsID=<%=LproductsID%>&bar=<%=productsID%>"><%=LproductsName%></a></td>
<% num=num+1
if num=allnum then exit for
rs.moveNext
if rs.eof then exit for
next%>
</tr>
<%
if num=allnum then exit for
if rs.eof then exit for
next
end if
rs.close%>
%>
</table></td>
</tr>
<%
rsproducts.movenext
wend
rsproducts.close
%>
</table>
光点科技
2023-08-15 广告
2023-08-15 广告
通常情况下,我们会按照结构模型把系统产生的数据分为三种类型:结构化数据、半结构化数据和非结构化数据。结构化数据,即行数据,是存储在数据库里,可以用二维表结构来逻辑表达实现的数据。最常见的就是数字数据和文本数据,它们可以某种标准格式存在于文件...
点击进入详情页
本回答由光点科技提供
展开全部
代码不看的,太长的.
做法:Asp + Ajax
做2个表,
表一:ID,Value
表二:ID,S_ID(上一级ID),Value
/********看错题目的***/
简单做法
Dim sRs
sSql = "查询一"
Set sRs = Conn.Execute(sSql)
开始循环
输出表格
Set sRs2 = Conn.Execute("select * from biao where ID =" & sRs("ID"))
开始循环
输出表格
结束循环
结束循环
关闭数据集 和 连接
简单的写了以下
做法:Asp + Ajax
做2个表,
表一:ID,Value
表二:ID,S_ID(上一级ID),Value
/********看错题目的***/
简单做法
Dim sRs
sSql = "查询一"
Set sRs = Conn.Execute(sSql)
开始循环
输出表格
Set sRs2 = Conn.Execute("select * from biao where ID =" & sRs("ID"))
开始循环
输出表格
结束循环
结束循环
关闭数据集 和 连接
简单的写了以下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
学习中
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<table width="200" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200"></td>
</tr>
<tr>
<td valign="top">
<%
Set rsproducts=server.CreateObject ("Adodb.recordset")
sql="select * from products where flang=1 and ID=0"
rsproducts.open sql,conn,1,1
count = 0
do while not rsproducts.eof
productsID =trim(rsproducts("productsID"))
productseID =trim(rsproducts("productseID"))
productsName =trim(rsproducts("productsName"))
productsPic =trim(rsproducts("productsPic"))
%>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="200" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td height="30"> <%=productsName%> </td>
</tr>
</tbody>
</table>
<br /></td>
</tr>
<tr>
<td valign="top">
<table width="94%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#f5f5f5" class="gray">
<tr valign="top" align="middle">
<%
Set rs=server.CreateObject ("Adodb.recordset")
sql="select * from products where productseID="&productsID&""
rs.open sql,conn,1,1
do while not rs.eof
LproductsID =trim(rs("productsID"))
LproductseID =trim(rs("productseID"))
LproductsName =trim(rs("productsName"))
LproductsPic =trim(rs("productsPic"))
%>
<td width="10"bgcolor="ffffff"><img src="/images/tou.gif" width="24" height="24" /></td>
<td height="20" valign="top" bgcolor="ffffff"><a href="small.asp?productsID=<%=LproductsID%>&bar=<%=productsID%>"><%=LproductsName%></a></td>
<br />
<%
rs.movenext
loop
rs.close
set rs=nothing
%></tr>
</table></td>
</tr>
</table>
<br /></td>
</tr>
</tbody>
</table>
<%
count=count+1
rsproducts.movenext
loop
rsproducts.close
set rsproducts=nothing
conn.close
set conn=nothing
%>
<br /></td>
</tr>
</table>
我没测试。应该是可以。。
<tr>
<td width="200"></td>
</tr>
<tr>
<td valign="top">
<%
Set rsproducts=server.CreateObject ("Adodb.recordset")
sql="select * from products where flang=1 and ID=0"
rsproducts.open sql,conn,1,1
count = 0
do while not rsproducts.eof
productsID =trim(rsproducts("productsID"))
productseID =trim(rsproducts("productseID"))
productsName =trim(rsproducts("productsName"))
productsPic =trim(rsproducts("productsPic"))
%>
<table width="200" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td width="200" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td valign="top"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tbody>
<tr>
<td height="30"> <%=productsName%> </td>
</tr>
</tbody>
</table>
<br /></td>
</tr>
<tr>
<td valign="top">
<table width="94%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#f5f5f5" class="gray">
<tr valign="top" align="middle">
<%
Set rs=server.CreateObject ("Adodb.recordset")
sql="select * from products where productseID="&productsID&""
rs.open sql,conn,1,1
do while not rs.eof
LproductsID =trim(rs("productsID"))
LproductseID =trim(rs("productseID"))
LproductsName =trim(rs("productsName"))
LproductsPic =trim(rs("productsPic"))
%>
<td width="10"bgcolor="ffffff"><img src="/images/tou.gif" width="24" height="24" /></td>
<td height="20" valign="top" bgcolor="ffffff"><a href="small.asp?productsID=<%=LproductsID%>&bar=<%=productsID%>"><%=LproductsName%></a></td>
<br />
<%
rs.movenext
loop
rs.close
set rs=nothing
%></tr>
</table></td>
</tr>
</table>
<br /></td>
</tr>
</tbody>
</table>
<%
count=count+1
rsproducts.movenext
loop
rsproducts.close
set rsproducts=nothing
conn.close
set conn=nothing
%>
<br /></td>
</tr>
</table>
我没测试。应该是可以。。
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询