ASP 商品排列 不规则

来源:百度知道 编辑:UC知道 时间:2024/06/25 00:33:57
<%
dim i,intPage,page,pre,last,filepath'定义变量
if request.QueryString("name")="fenleione" then
sql="select * from [product] where class_pid="&request.QueryString("class_aid")
elseif request.QueryString("name")="fenlei" then
sql="select * from [product] where class_p1id="&request.QueryString("class_aid")
elseif request.QueryString("name")="" then
sql="select * from [product] where p_jingpin=1 and p_sellout=false"
end if
rs1.PageSize = 20 '这里设定每页显示的记录数
rs1.CursorLocation = 3
rs1.Open sql,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
pre = true
last = true
page = trim(Request.QueryString("page"))'变量是跳转页面时的值
if len(page) = 0 then
intpage = 1
pre = false

使用表格控制一下,试试,将
for i=1 to rs1.PageSize
if rs1.EOF or rs1.BOF then exit for%>
<div class="products">
<p class="img"><a href="details.asp?name=jingpin&classaid=<%=rs1("class_pid")%>&classbid=<%=rs1("class_p1id")%>&p_id=<%=rs1("p_id")%>"><img src="<%=rs1("p_photo")%>" width="100" height="125" style="border:0px" alt="<%=rs1("p_name")%>"/></a></p>
<p class="title1"><a href="details.asp?name=jingpin&classaid=<%=rs1("class_pid")%>&classbid=<%=rs1("class_p1id")%>&p_id=<%=rs1("p_id")%>"><%if len(rs1("p_name"))>8 then response.Write(left(rs1("p_name"),8)&"...") else response.Write(rs1("p_name")) end if%></a></p>
<p class=&