asp如何让产品一行显示两个,现在显示是一行显示一个,共十个后可翻页。求解
<%BigClassID=request.QueryString("BigClassID")SmallClassID=request.QueryString("Small...
<%
BigClassID=request.QueryString("BigClassID")
SmallClassID=request.QueryString("SmallClassID")
if not isnumeric(BigClassID) or not isnumeric(SmallClassID) then
Response.Write "<script>alert('警告!请勿尝试注入!');history.go(-1);</script>"
Response.End()
end if
set rs=server.createobject("adodb.recordset")
if BigClassID="" then
exec="select * from products order by id desc"
end if
if BigClassID<>"" then
exec="select * from products where BigClassID="&BigClassID&" order by id desc"
end if
if BigClassID<>"" and SmallClassID<>"" then
exec="select * from products where BigClassID="&BigClassID&" and SmallClassID="&SmallClassID&" order by id desc"
end if
rs.open exec,conn,1,1
if rs.eof then
response.Write "<div style=""padding:10px"">暂无产品!</a>"
response.End()
else
rs.PageSize =""&config("productsclass")&""
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
end if
For i=1 To x
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="320" border="0" cellpadding="5" cellspacing="1">
<tr>
<td width="36%" rowspan="3"><div align="left"><a href="Productsviwe.asp?id=<%=rs("id")%>" class="img" title="<%=rs("title")%>" target="_blank"><img src="<%=rs("img")%>" width="180" height="150" border="0" /></a></div></td>
<td width="64%">型号:<%=rs("zz")%></td>
</tr>
<tr>
<td>价格:¥<%=rs("jiage")%> 元</td>
</tr>
<tr>
<td><a href="Productsviwe.asp?id=<%=rs("id")%>" target="_blank"><img src="images/botton_view_1.jpg" width="50" height="22" border="0" /></a><br />
<br /> </td>
</tr>
<tr>
<td align="center"><div style="font-weight:bold; color:#333333"><a href="Productsviwe.asp?id=<%=rs("id")%>" title="<%=rs("title")%>"><%=InterceptString(rs("title"),20)%></a></div></td>
<td> </td>
</tr>
</table></td>
<%
rs.movenext
next
%>
</tr>
</table> 展开
BigClassID=request.QueryString("BigClassID")
SmallClassID=request.QueryString("SmallClassID")
if not isnumeric(BigClassID) or not isnumeric(SmallClassID) then
Response.Write "<script>alert('警告!请勿尝试注入!');history.go(-1);</script>"
Response.End()
end if
set rs=server.createobject("adodb.recordset")
if BigClassID="" then
exec="select * from products order by id desc"
end if
if BigClassID<>"" then
exec="select * from products where BigClassID="&BigClassID&" order by id desc"
end if
if BigClassID<>"" and SmallClassID<>"" then
exec="select * from products where BigClassID="&BigClassID&" and SmallClassID="&SmallClassID&" order by id desc"
end if
rs.open exec,conn,1,1
if rs.eof then
response.Write "<div style=""padding:10px"">暂无产品!</a>"
response.End()
else
rs.PageSize =""&config("productsclass")&""
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
end if
For i=1 To x
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><table width="320" border="0" cellpadding="5" cellspacing="1">
<tr>
<td width="36%" rowspan="3"><div align="left"><a href="Productsviwe.asp?id=<%=rs("id")%>" class="img" title="<%=rs("title")%>" target="_blank"><img src="<%=rs("img")%>" width="180" height="150" border="0" /></a></div></td>
<td width="64%">型号:<%=rs("zz")%></td>
</tr>
<tr>
<td>价格:¥<%=rs("jiage")%> 元</td>
</tr>
<tr>
<td><a href="Productsviwe.asp?id=<%=rs("id")%>" target="_blank"><img src="images/botton_view_1.jpg" width="50" height="22" border="0" /></a><br />
<br /> </td>
</tr>
<tr>
<td align="center"><div style="font-weight:bold; color:#333333"><a href="Productsviwe.asp?id=<%=rs("id")%>" title="<%=rs("title")%>"><%=InterceptString(rs("title"),20)%></a></div></td>
<td> </td>
</tr>
</table></td>
<%
rs.movenext
next
%>
</tr>
</table> 展开
2个回答
展开全部
<%
BigClassID=request.QueryString("BigClassID")
SmallClassID=request.QueryString("SmallClassID")
if not isnumeric(BigClassID) or not isnumeric(SmallClassID) then
Response.Write "<script>alert('警告!请勿尝试注入!');history.go(-1);</script>"
Response.End()
end if
set rs=server.createobject("adodb.recordset")
if BigClassID="" then
exec="select * from products order by id desc"
end if
if BigClassID<>"" then
exec="select * from products where BigClassID="&BigClassID&" order by id desc"
end if
if BigClassID<>"" and SmallClassID<>"" then
exec="select * from products where BigClassID="&BigClassID&" and SmallClassID="&SmallClassID&" order by id desc"
end if
rs.open exec,conn,1,1
if rs.eof then
response.Write "<div style=""padding:10px"">暂无产品!</a>"
response.End()
else
rs.PageSize =""&config("productsclass")&""
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
end if
i=0
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<%For i=1 To x%>
<td><table width="320" border="0" cellpadding="5" cellspacing="1">
<tr>
<td width="36%" rowspan="3"><div align="left"><a href="Productsviwe.asp?id=<%=rs("id")%>" class="img" title="<%=rs("title")%>" target="_blank"><img src="<%=rs("img")%>" width="180" height="150" border="0" /></a></div></td>
<td width="64%">型号:<%=rs("zz")%></td>
</tr>
<tr>
<td>价格:¥<%=rs("jiage")%> 元</td>
</tr>
<tr>
<td><a href="Productsviwe.asp?id=<%=rs("id")%>" target="_blank"><img src="images/botton_view_1.jpg" width="50" height="22" border="0" /></a><br />
<br /> </td>
</tr>
<tr>
<td align="center"><div style="font-weight:bold; color:#333333"><a href="Productsviwe.asp?id=<%=rs("id")%>" title="<%=rs("title")%>"><%=InterceptString(rs("title"),20)%></a></div></td>
<td> </td>
</tr>
</table></td>
<%
i=i+1
if i mod 2 = 0 then response.Write "</tr><tr>"
rs.movenext
next
%>
</tr>
</table>
然后你在下面加一个分页就可以了!
BigClassID=request.QueryString("BigClassID")
SmallClassID=request.QueryString("SmallClassID")
if not isnumeric(BigClassID) or not isnumeric(SmallClassID) then
Response.Write "<script>alert('警告!请勿尝试注入!');history.go(-1);</script>"
Response.End()
end if
set rs=server.createobject("adodb.recordset")
if BigClassID="" then
exec="select * from products order by id desc"
end if
if BigClassID<>"" then
exec="select * from products where BigClassID="&BigClassID&" order by id desc"
end if
if BigClassID<>"" and SmallClassID<>"" then
exec="select * from products where BigClassID="&BigClassID&" and SmallClassID="&SmallClassID&" order by id desc"
end if
rs.open exec,conn,1,1
if rs.eof then
response.Write "<div style=""padding:10px"">暂无产品!</a>"
response.End()
else
rs.PageSize =""&config("productsclass")&""
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
end if
i=0
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<%For i=1 To x%>
<td><table width="320" border="0" cellpadding="5" cellspacing="1">
<tr>
<td width="36%" rowspan="3"><div align="left"><a href="Productsviwe.asp?id=<%=rs("id")%>" class="img" title="<%=rs("title")%>" target="_blank"><img src="<%=rs("img")%>" width="180" height="150" border="0" /></a></div></td>
<td width="64%">型号:<%=rs("zz")%></td>
</tr>
<tr>
<td>价格:¥<%=rs("jiage")%> 元</td>
</tr>
<tr>
<td><a href="Productsviwe.asp?id=<%=rs("id")%>" target="_blank"><img src="images/botton_view_1.jpg" width="50" height="22" border="0" /></a><br />
<br /> </td>
</tr>
<tr>
<td align="center"><div style="font-weight:bold; color:#333333"><a href="Productsviwe.asp?id=<%=rs("id")%>" title="<%=rs("title")%>"><%=InterceptString(rs("title"),20)%></a></div></td>
<td> </td>
</tr>
</table></td>
<%
i=i+1
if i mod 2 = 0 then response.Write "</tr><tr>"
rs.movenext
next
%>
</tr>
</table>
然后你在下面加一个分页就可以了!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询