ASP图片三行四列的显示

 

<%
 '按类型
 if request("lai") <> "" then
 lai=request("lai")
 else
 lai="开瓶器"
 end if
%>
<%
 '链接
 dim pic_lai
 pic_lai=request("lai")
 if pic_lai<>"" then 
 sql="select * From pic where lai='"&pic_lai&"'and xs='yes' order by id desc"
 set rs=Server.CreateObject("ADODB.Recordset")
 rs.Open sql,conn,1
 else
 sql="select * From pic where lai ='开瓶器'and xs='yes' order by id desc"
 set rs=Server.CreateObject("ADODB.Recordset")
 rs.Open sql,conn,1
 end if
 IF not IsNumeric(Request("page")) Or IsEmpty(Request("page")) Then
 page=1
 Else
 Page=Int(Abs(Request("page")))
 End if
 rs.pagesize =16
 total = rs.RecordCount
 rs.absolutepage = page
%>

....

<% if not rs.EOF or not rs.BOF then %><%=rs("lai")%><%end if%></div>
  <%if Not rs.EOF Or Not rs.BOF Then %>
    <table width="120"  border="0" align="center" cellpadding="0" cellspacing="10">
<%for j=1 to (rs.pagesize\4)%>
      <tr align="center" valign="top">
<%for i=1 to 3%>
       <td height="140">
   <table width="93%" border="0" align="center"  class="tab">
       <tr>
        <td colspan="3" align="center" valign="top"><a href="products_show.asp?id=<%=rs("id")%>"><img  src="uppic/<%=rs("img")%>" width="140" height="120" border="0" ></a></td>
         </tr>
         <tr>
     <td width="16%" align="center" valign="middle"><img src="images/link3.gif" width="14" height="13" /> </td>
         <td width="84%" align="left"><div style="width:100px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;"><a href="pic_show.asp?id=<%=rs("id")%>"> <%=rs("名称")%></a></div></td>
         </tr>
         </table>    </td>
    <%
     rs.movenext
     if rs.eof then
     exit for
     end if
     next
    %>
        </tr>
   <%
    if rs.eof then
    exit for
    end if
    next
   %>
 </table>
 <table width="60%" border="0" align="center" cellpadding="5" cellspacing="0">
  <tr>
    <td height="54" align="center">
     共<font color=#fff><b><%=rs.pagecount%></b></font>页<font color=#fff><b><%=total%></b></font>个 当前第<font color=#fff><b><%=page%></b></font>页
     <%if page>1 then%> <a href=products.asp?page=<%=page-1%>&lai=<%=lai%>>上一页</a>
     <%else%> <a href=#>上一页</a>
     <%end if%> <%if page<rs.pagecount then%> <a href=products.asp?page=<%=page+1%>&lai=<%=lai%> >下一页</a>
     <%else%> <a href="#" >下一页</a>
     <%end if%>
     <select name="menu1" onchange="MM_jumpMenu('parent',this,1)">
     <option value="#">请选择</option>
     <%for i=1 to rs.pagecount%>
      <option value="products.asp?lai=<%=lai%>&page=<%=i%>">第<%=i%>页</option>
      <%next%>
     </select> 
     </td>
  </tr>
 </table>
<%end if %>

你可能感兴趣的:(asp)