这样的asp代码怎么改成横向的?现在是竖着放的,我想改成2列4行显示
<%dimrecommendrecommend=request("recommend")sql="selecttop4*fromproductwhererecommend...
<%dim recommend
recommend=request("recommend")
sql="select top 4 * from product where recommend=1 order by dateandtime desc"
set rs=conn.execute(sql)%> <%
while not rs.eof
%> <table width="100%" border="0" cellspacing="2" cellpadding="1">
<tr>
<td> <div align="center">
<p>
<% if rs("images")="" then %>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="images/nopic.gif" border="0"></a>
<%else%>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="<%=rs("images")%>" border="0" width="95" height="95"></a>
<%end if%>
</p>
<p><font style=line-height:150%>名称:<a href="productview.asp?id=<%=rs("productid")%>" title=<%=left(rs("Nkey"),20)%>><%=left(rs("title"),13)%>...</a><br>
价格:
<%if not isnull(rs("price")) then%>
<%=rs("price")%>
<%else%>
不详
<%end if%>
</font></p>
</div></td>
</tr>
<tr>
<td height="5" background="images/bg.gif"></td>
</tr>
</table>
<%rs.movenext
wend
rs.close
'set rs=nothing
'conn.close
'set conn=nothing %> 展开
recommend=request("recommend")
sql="select top 4 * from product where recommend=1 order by dateandtime desc"
set rs=conn.execute(sql)%> <%
while not rs.eof
%> <table width="100%" border="0" cellspacing="2" cellpadding="1">
<tr>
<td> <div align="center">
<p>
<% if rs("images")="" then %>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="images/nopic.gif" border="0"></a>
<%else%>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="<%=rs("images")%>" border="0" width="95" height="95"></a>
<%end if%>
</p>
<p><font style=line-height:150%>名称:<a href="productview.asp?id=<%=rs("productid")%>" title=<%=left(rs("Nkey"),20)%>><%=left(rs("title"),13)%>...</a><br>
价格:
<%if not isnull(rs("price")) then%>
<%=rs("price")%>
<%else%>
不详
<%end if%>
</font></p>
</div></td>
</tr>
<tr>
<td height="5" background="images/bg.gif"></td>
</tr>
</table>
<%rs.movenext
wend
rs.close
'set rs=nothing
'conn.close
'set conn=nothing %> 展开
2个回答
展开全部
<!--///////////////设置一个计数器就可以了////////////-->
<%dim recommend
recommend=request("recommend")
sql="select top 8 * from product where recommend=1 order by dateandtime desc"
set rs=conn.execute(sql)
i=0
%>
<table width="100%" border="0" cellspacing="2" cellpadding="1">
<tr>
<%while not rs.eof
i=i+1%>
<td><div align="center">
<p>
<% if rs("images")="" then %>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="images/nopic.gif" border="0"></a>
<%else%>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="<%=rs("images")%>" border="0" width="95" height="95"></a>
<%end if%>
</p>
<p><font style=line-height:150%>名称:<a href="productview.asp?id=<%=rs("productid")%>" title=<%=left(rs("Nkey"),20)%>><%=left(rs("title"),13)%>...</a><br>
价格:
<%if not isnull(rs("price")) then%>
<%=rs("price")%>
<%else%>
不详
<%end if%>
</font></p>
</div></td>
<%
if i mod 2=0 then Response.Write("</tr><tr>")
rs.movenext
wend %>
</tr>
</table>
<%
rs.close
'set rs=nothing
'conn.close
'set conn=nothing %>
<%dim recommend
recommend=request("recommend")
sql="select top 8 * from product where recommend=1 order by dateandtime desc"
set rs=conn.execute(sql)
i=0
%>
<table width="100%" border="0" cellspacing="2" cellpadding="1">
<tr>
<%while not rs.eof
i=i+1%>
<td><div align="center">
<p>
<% if rs("images")="" then %>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="images/nopic.gif" border="0"></a>
<%else%>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="<%=rs("images")%>" border="0" width="95" height="95"></a>
<%end if%>
</p>
<p><font style=line-height:150%>名称:<a href="productview.asp?id=<%=rs("productid")%>" title=<%=left(rs("Nkey"),20)%>><%=left(rs("title"),13)%>...</a><br>
价格:
<%if not isnull(rs("price")) then%>
<%=rs("price")%>
<%else%>
不详
<%end if%>
</font></p>
</div></td>
<%
if i mod 2=0 then Response.Write("</tr><tr>")
rs.movenext
wend %>
</tr>
</table>
<%
rs.close
'set rs=nothing
'conn.close
'set conn=nothing %>
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<%dim recommend
recommend=request("recommend")
sql="select top 4 * from product where recommend=1 order by dateandtime desc"
set rs=conn.execute(sql)%>
<table width="100%" border="0" cellspacing="2" cellpadding="1">
<%
while not rs.eof
%>
<tr>
<td> <div align="center">
<p>
<% if rs("images")="" then %>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="images/nopic.gif" border="0"></a>
<%else%>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="<%=rs("images")%>" border="0" width="95" height="95"></a>
<%end if%>
</p>
<p><font style=line-height:150%>名称:<a href="productview.asp?id=<%=rs("productid")%>" title=<%=left(rs("Nkey"),20)%>><%=left(rs("title"),13)%>...</a><br>
价格:
<%if not isnull(rs("price")) then%>
<%=rs("price")%>
<%else%>
不详
<%end if%>
</font></p>
</div>
</td>
</tr>
<tr>
<td height="5" background="images/bg.gif"></td>
</tr>
<%rs.movenext
wend
%>
</table>
<%
rs.close
'set rs=nothing
'conn.close
'set conn=nothing %>
recommend=request("recommend")
sql="select top 4 * from product where recommend=1 order by dateandtime desc"
set rs=conn.execute(sql)%>
<table width="100%" border="0" cellspacing="2" cellpadding="1">
<%
while not rs.eof
%>
<tr>
<td> <div align="center">
<p>
<% if rs("images")="" then %>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="images/nopic.gif" border="0"></a>
<%else%>
<a href="productview.asp?id=<%=rs("productid")%>"><img src="<%=rs("images")%>" border="0" width="95" height="95"></a>
<%end if%>
</p>
<p><font style=line-height:150%>名称:<a href="productview.asp?id=<%=rs("productid")%>" title=<%=left(rs("Nkey"),20)%>><%=left(rs("title"),13)%>...</a><br>
价格:
<%if not isnull(rs("price")) then%>
<%=rs("price")%>
<%else%>
不详
<%end if%>
</font></p>
</div>
</td>
</tr>
<tr>
<td height="5" background="images/bg.gif"></td>
</tr>
<%rs.movenext
wend
%>
</table>
<%
rs.close
'set rs=nothing
'conn.close
'set conn=nothing %>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询