求助图片横向排列ASP代码

求助高手帮改一下图片排列代码,我想要每页显示12个图片,每行6个,分两行,但现在情况是第一行10个,第二行1个。这种情况怎样解决,希望高手帮修改一下,谢谢了!<table... 求助高手帮改一下图片排列代码,我想要每页显示12个图片,每行6个,分两行,但现在情况是第一行10个,第二行1个。这种情况怎样解决,希望高手帮修改一下,谢谢了!
<table width="100%" border="0">
<tr>
<%Set rs=Server.CreateObject("ADODB.Recordset")
dim x
If rikeenet("lbid")="" Then
sql="select * from uanpin where p_zt=0 and cang=0 and userid="&rikeenet("shopid")&" order by sj2 desc"

Else
sql="select * from uanpin where p_zt=0 and cang=0 and userlb="&userlbid&" and userid="&rikeenet("shopid")&" order by sj2 desc"
End if
rs.open sql,conn,3,1
if rs.eof then
response.write"暂无内容"
else
rs.PageSize =12 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")

if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if

if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if

rs.AbsolutePage=Page

if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if

For y=y+1 To x%>

<td ><table width="100" border="0" align="center">
<tr>
<td><div align="center"><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"> <img src="../../members/images/rikeeupimages/<%=rs("xt")%>" alt="<%=rs("jp")%>" width="85" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"><%=rs("cp")%></a></td>
</tr>
<tr>
<td><%if rs("fs")=0 then%>
一口价:
<%elseif rs("fs")=1 then%>
竞价:
<%elseif rs("fs")=2 then%>
议价
<%end if%>
<%if rs("fs")<>2 then%>
<%=rs("jg1")%>元
<%End if%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span class="ItemTimeLeftHint">剩余:</span><%=DateDiff("h", now(), rs("sj2"))%>小时</td>
</tr>
</table></td>

<%
if x mod 6 = 0 then
response.write "<tr></tr>"
end if
rs.MoveNext
x=y+1
next
call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")%>
</tr>
</table></td>
</tr>
</table><table width="98%" cellpadding="0" cellspacing="0">
<tr>
<td height="30" align="center" valign="middle"><%end if
rs.close
set rs=Nothing
%>
</td>
</tr>
</table>
展开
 我来答
aiyouxinsheng1
2009-08-08 · 超过21用户采纳过TA的回答
知道答主
回答量:97
采纳率:0%
帮助的人:0
展开全部
我这有代码,你回去好改下就可以了
<!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>
<%'开始分页
Const MaxPerPage=12
dim totalPut
dim CurrentPage
dim TotalPages
dim j
dim sql
if Not isempty(request("page")) then
currentPage=Cint(request("page"))
else
currentPage=1
end if
dim lx
If rikeenet("lbid")="" Then
sql="select * from uanpin where p_zt=0 and cang=0 and userid="&rikeenet("shopid")&" order by sj2 desc"

Else
sql="select * from uanpin where p_zt=0 and cang=0 and userlb="&userlbid&" and userid="&rikeenet("shopid")&" order by sj2 desc"
End if
rs.open sql,conn,3,1

if err.number<>0 then
response.write ""
end if

if rs.eof And rs.bof then
Response.Write "<p align='center' class='css1'> 对不起,暂时还没有任何反馈信息!</p>"
else
totalPut=rs.recordcount

if currentpage<1 then
currentpage=1
end if

if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if

if currentPage=1 then
showContent
showpage totalput,MaxPerPage,"ypsc1.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxPerPage,"ypsc1.asp"
else
currentPage=1
showContent
showpage totalput,MaxPerPage,"ypsc1.asp"
end if
end if
end if

sub showContent
dim i
i=0

%>
<table width="98%" align="center" cellpadding="0" cellspacing="0">
<tr><td>
<%do while not rs.eof%>
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td><%if i<MaxPerPage then
if not rs.eof then%><table width="100" border="0" align="center">
<tr>
<td><div align="center"><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"> <img src="../../members/images/rikeeupimages/<%=rs("xt")%>" alt="<%=rs("jp")%>" width="85" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"><%=rs("cp")%></a></td>
</tr>
<tr>
<td><%if rs("fs")=0 then%>
一口价:
<%elseif rs("fs")=1 then%>
竞价:
<%elseif rs("fs")=2 then%>
议价
<%end if%>
<%if rs("fs")<>2 then%>
<%=rs("jg1")%>元
<%End if%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span class="ItemTimeLeftHint">剩余:</span><%=DateDiff("h", now(), rs("sj2"))%>小时</td>
</tr>
</table> <%
i=i+1
rs.movenext
else
%><table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td > </td>

</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table> <%end if
end if
%></td>
<td><%if i<MaxPerPage then
if not rs.eof then%><table width="100" border="0" align="center">
<tr>
<td><div align="center"><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"> <img src="../../members/images/rikeeupimages/<%=rs("xt")%>" alt="<%=rs("jp")%>" width="85" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"><%=rs("cp")%></a></td>
</tr>
<tr>
<td><%if rs("fs")=0 then%>
一口价:
<%elseif rs("fs")=1 then%>
竞价:
<%elseif rs("fs")=2 then%>
议价
<%end if%>
<%if rs("fs")<>2 then%>
<%=rs("jg1")%>元
<%End if%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span class="ItemTimeLeftHint">剩余:</span><%=DateDiff("h", now(), rs("sj2"))%>小时</td>
</tr>
</table> <%
i=i+1
rs.movenext
else
%><table width="100%" cellspacing="0" cellpadding="0" >
<tr>
<td> </td>
</tr>

<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table> <%end if
end if
%></td>
<td><%if i<MaxPerPage then
if not rs.eof then%><table width="100" border="0" align="center">
<tr>
<td><div align="center"><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"> <img src="../../members/images/rikeeupimages/<%=rs("xt")%>" alt="<%=rs("jp")%>" width="85" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"><%=rs("cp")%></a></td>
</tr>
<tr>
<td><%if rs("fs")=0 then%>
一口价:
<%elseif rs("fs")=1 then%>
竞价:
<%elseif rs("fs")=2 then%>
议价
<%end if%>
<%if rs("fs")<>2 then%>
<%=rs("jg1")%>元
<%End if%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span class="ItemTimeLeftHint">剩余:</span><%=DateDiff("h", now(), rs("sj2"))%>小时</td>
</tr>
</table> <%
i=i+1
rs.movenext
else
%><table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="17%"> </td>
</tr>

<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table> <%end if
end if
%></td>
<td><%if i<MaxPerPage then
if not rs.eof then%><table width="100" border="0" align="center">
<tr>
<td><div align="center"><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"> <img src="../../members/images/rikeeupimages/<%=rs("xt")%>" alt="<%=rs("jp")%>" width="85" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"><%=rs("cp")%></a></td>
</tr>
<tr>
<td><%if rs("fs")=0 then%>
一口价:
<%elseif rs("fs")=1 then%>
竞价:
<%elseif rs("fs")=2 then%>
议价
<%end if%>
<%if rs("fs")<>2 then%>
<%=rs("jg1")%>元
<%End if%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span class="ItemTimeLeftHint">剩余:</span><%=DateDiff("h", now(), rs("sj2"))%>小时</td>
</tr>
</table> <%
i=i+1
rs.movenext
else
%><table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="17%"> </td>
</tr>

<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table> <%end if
end if
%></td>
<td><%if i<MaxPerPage then
if not rs.eof then%><table width="100" border="0" align="center">
<tr>
<td><div align="center"><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"> <img src="../../members/images/rikeeupimages/<%=rs("xt")%>" alt="<%=rs("jp")%>" width="85" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"><%=rs("cp")%></a></td>
</tr>
<tr>
<td><%if rs("fs")=0 then%>
一口价:
<%elseif rs("fs")=1 then%>
竞价:
<%elseif rs("fs")=2 then%>
议价
<%end if%>
<%if rs("fs")<>2 then%>
<%=rs("jg1")%>元
<%End if%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span class="ItemTimeLeftHint">剩余:</span><%=DateDiff("h", now(), rs("sj2"))%>小时</td>
</tr>
</table> <%
i=i+1
rs.movenext
else
%><table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="17%"> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>

</table> <%end if
end if
%></td>
<td><%if i<MaxPerPage then
if not rs.eof then%><table width="100" border="0" align="center">
<tr>
<td><div align="center"><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"> <img src="../../members/images/rikeeupimages/<%=rs("xt")%>" alt="<%=rs("jp")%>" width="85" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"><%=rs("cp")%></a></td>
</tr>
<tr>
<td><%if rs("fs")=0 then%>
一口价:
<%elseif rs("fs")=1 then%>
竞价:
<%elseif rs("fs")=2 then%>
议价
<%end if%>
<%if rs("fs")<>2 then%>
<%=rs("jg1")%>元
<%End if%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span class="ItemTimeLeftHint">剩余:</span><%=DateDiff("h", now(), rs("sj2"))%>小时</td>
</tr>
</table> <%
i=i+1
rs.movenext
else
%><table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="17%"> </td>
</tr>

<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table> <%end if
end if
%></td>
<%
if i>=MaxPerPage then Exit DO
loop
rs.close
set rs=nothing
%>
</tr>
<tr>
<td colspan="6"><%
End Sub

Function showpage(totalnumber,maxperpage,filename)
Dim n

If totalnumber Mod maxperpage=0 Then
n= totalnumber \ maxperpage
Else
n= totalnumber \ maxperpage+1
End If

Response.Write "<form method=Post action="&filename&"?tt="&request("tt")&">"
Response.Write "<p align='center' class='css1'> "
If CurrentPage<2 Then
Response.Write "<font class='css1'>首页 上一页</font> "
Else
Response.Write "<a href="&filename&"?page=1&tt="&request("tt")&">首页</a> "
Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&tt="&request("tt")&">上一页</a> "
End If

If n-currentpage<1 Then
Response.Write "<font class='css1'>下一页 尾页</font>"
Else
Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&tt="&request("tt")&">"
Response.Write "下一页</a> <a href="&filename&"?page="&n&"&tt="&request("tt")&">尾页</a>"
End If
Response.Write "<font class='css1'> 页次:</font><font class='css1'>"&CurrentPage&"</font><font class='css1'>/"&n&"页</font> "
Response.Write "<font class='css1'> 共有"&totalnumber&"条记录 "
Response.Write "<font class='css1'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="¤tpage&">"
Response.Write " <input type='submit' class='css1' value='跳转' name='cndok'></form>"
End Function
%></td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
nxnd1986
推荐于2016-08-30 · TA获得超过2248个赞
知道小有建树答主
回答量:903
采纳率:0%
帮助的人:621万
展开全部
<table width="100%" border="0">
<tr>
<%Set rs=Server.CreateObject("ADODB.Recordset")
dim x
If rikeenet("lbid")="" Then
sql="select * from uanpin where p_zt=0 and cang=0 and userid="&rikeenet("shopid")&" order by sj2 desc"

Else
sql="select * from uanpin where p_zt=0 and cang=0 and userlb="&userlbid&" and userid="&rikeenet("shopid")&" order by sj2 desc"
End if
rs.open sql,conn,3,1
if rs.eof then
response.write"暂无内容"
else
rs.PageSize =12 '每页记录条数
iCount=rs.RecordCount '记录总数
iPageSize=rs.PageSize
maxpage=rs.PageCount
page=request("page")

if Not IsNumeric(page) or page="" then
page=1
else
page=cint(page)
end if

if page<1 then
page=1
elseif page>maxpage then
page=maxpage
end if

rs.AbsolutePage=Page

if page=maxpage then
x=iCount-(maxpage-1)*iPageSize
else
x=iPageSize
end if
For y=1 To x
if y mod int(x/2) =1 then Response.Write("<tr>")%>
<td ><table width="100" border="0" align="center">
<tr>
<td><div align="center"><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"> <img src="../../members/images/rikeeupimages/<%=rs("xt")%>" alt="<%=rs("jp")%>" width="85" height="75" border="0" /></a></div></td>
</tr>
<tr>
<td><a href="../../goodsinfo.asp?id=<%=encode(rs("id"))%>" target="_blank"><%=rs("cp")%></a></td>
</tr>
<tr>
<td><%if rs("fs")=0 then%>
一口价:
<%elseif rs("fs")=1 then%>
竞价:
<%elseif rs("fs")=2 then%>
议价
<%end if%>
<%if rs("fs")<>2 then%>
<%=rs("jg1")%>元
<%End if%></td>
</tr>
<tr>
<td></td>
</tr>
<tr>
<td><span class="ItemTimeLeftHint">剩余:</span><%=DateDiff("h", now(), rs("sj2"))%>小时</td>
</tr>
</table></td>

<%
if y mod int(x/2) = 0 then response.write("</tr>")
rs.MoveNext
next
call PageControl(iCount,maxpage,page,"border=0 align=center","<p align=center>")%>
</tr>
</table></td>
</tr>
</table><table width="98%" cellpadding="0" cellspacing="0">
<tr>
<td height="30" align="center" valign="middle"><%end if
rs.close
set rs=Nothing
%>
</td>
</tr>
</table>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式