Solution 1
CopyCode The Code is as follows: <! -- # Include file = "conn. asp" -->
<%
Owen1 = request ("owen1 ")
Owen2 = request ("owen2 ")
%>
<% page = clng (Request ("page ")) set rs = server. createobject ("ADODB. recordset ") If owen1 <> "" And owen2 <> "" Then SQL = "select * from news where bigclassname = '" & owen1 & "' and smallclassname =' "& owen2 &" 'order by id desc " Rs. open SQL, Conn, 1, 1 elseif owen1 <> "" Then SQL = "select * from news where bigclassname = '" & owen1 & "'order by ID DESC" rs. open SQL, Conn, 1, 1 end if If RS. EOF and Rs. bof then response. write ("no records for now") else %>
<%
Rs. pagesize = 15
If page = 0 Then page = 1
Pages = Rs. pagecount
If page> pages then page = pages
Rs. absolutepage = page
For j = 1 to Rs. pagesize
If (J-1) mod 3 = 0 then response. Write ("<tr> ")
%>
<TD Height = "24" align = "center">
<Div align = "center"> "width =" 130 "Height =" 100 "border =" 0 "/> <a href =" onews. asp? Id = <% = RS ("ID") %> "target =" _ blank "> <br>
<% = RS ("title") %> </a> </div> </TD>
<%
If J mod 3 = 0 then response. Write ("</tr> ")
Rs. movenext
If Rs. EOF then exit
Next
%>
<%
End if
Rs. Close
Set rs = nothing
%>
</Table>
Solution 2,Copy codeThe Code is as follows: <! -- # Include file = "conn. asp" -->
<%
Owen1 = request ("owen1 ")
Owen2 = request ("owen2 ")
%>
<% page = clng (Request ("page ")) set rs = server. createobject ("ADODB. recordset ") If owen1 <> "" And owen2 <> "" Then SQL = "select * from news where bigclassname = '" & owen1 & "' and smallclassname =' "& owen2 &" 'order by id desc " Rs. open SQL, Conn, 1, 1 elseif owen1 <> "" Then SQL = "select * from news where bigclassname = '" & owen1 & "'order by ID DESC" rs. open SQL, Conn, 1, 1 end if If RS. EOF and Rs. bof then response. write ("no records for now") else %>
<%
Rs. pagesize = 15
If page = 0 Then page = 1
Pages = Rs. pagecount
If page> pages then page = pages
Rs. absolutepage = page
For j = 1 to (Rs. pagesize/3)
Response. Write ("<tr> ")
For I = 1 to 3
%>
<TD Height = "24" align = "center">
<Div align = "center"> "width =" 130 "Height =" 100 "border =" 0 "/> <a href =" onews. asp? Id = <% = RS ("ID") %> "target =" _ blank "> <br>
<% = RS ("title") %> </a> </div> </TD>
<%
Rs. movenext
If Rs. EOF then exit
Next
Response. Write ("</tr> ")
Next
%>
<%
End if
Rs. Close
Set rs = nothing
%>
</Table>
The above code has disadvantages ..
That is, if there are 16 entries, the last line of the page will empty two columns of the page, which is hard to see because if only one column is displayed in the last line of 16, two fewer <TD> </TD>
The remainder of total number/3 must be judged
If (Rs. recordcount mod 3 = 2) then response. Write ("<TD> </TD> ")
If (Rs. recordcount mod 3 = 1) Then response. Write ("<TD> </TD> ")
In this way, the page is complete.