主题:请教高手
<table border="0" cellpadding="0" cellspacing="0" width="700" align="center">
<tr>
<td align="center" valign="top" width="580" colspan="2">
<% '=============打开数据库表,要以这种方式打开
set rs=server.CreateObject("adodb.recordset")
rs.open "select id,title,content,timefrom [News] where lm='1' order by id desc",conn,1,1
if rs.bof and rs.eof then
response.write"暂无信息"
response.end
end if
%>
<%'=============分页定义开始,要放在数据库打开之后
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '检测记录集是否为空
r=cint(rs.RecordCount) '记录总数
rowcount = 20 '设置每一页的数据记录数,可根据实际自定义
rs.pagesize = rowcount '分页记录集每页显示记录数
maxpagecount=rs.pagecount '分页页数
page=request.querystring("page")
if page="" then
page=1
end if
rs.absolutepage = page
rcount1=0
pagestart=page-9
pageend=page+9
if pagestart<1 then
pagestart=1
end if
if pageend>maxpagecount then
pageend=maxpagecount
end if
rcount=rs.RecordCount
'=============分页定义结束%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<%'===========循环体开始
do while not rs.eof and rowcount%>
<table width="600" border="0" align="center" cellpadding="2" cellspacing="1">
<tr <%if icolor=0 then response.write"bgColor=#FFFAFC" else response.write"bgColor=#ffffff" end if%>>
<td width="100%"><div align="left"> · <a href=/news_view.asp?newsid=<%=rs("id")%> >
<%=left(rs("title"),50)%>
<% if len(rs("title"))>=50 then%>
…
<%end if%>
</a></div></td>
</tr>
</table>
<%
rowcount=rowcount-1
rs.movenext
icolor=icolor+1
if icolor>1 then icolor=0
loop
end if
end if
'===========循环体结束%>
</td>
</tr>
</table>
<%'===========显示分页的过程调用,要放在数据库打开后、释放资源前
call listPages()
rs.close '释放资源
set rs=nothing%>
<%'==========分页过程开始,也可单独创建一文件在本文件前包含调用
sub listPages() '定义过程开始%>
</td>
</tr>
<tr align="left">
<td bgcolor=#E4E4E4 >
<%if pagestart=1 then%>
<FONT face=webdings><span style="color: #FF0000"> 9</span></font>
<%else%>
<a href=xinhunf.asp?page=1&lm="&lm&" title="首页"><FONT
face=webdings><span >9</span></font></a>
<%end if%>
<% for i=pagestart to pageend
if i=0 then
i=1
end if
strurl="<a href=xinhunf.asp?page="&i&"&lm="&lm&" title='到"&i&"页'>"&i&"</a>"
response.write strurl
response.write " "
next
%>
<%if pageend=maxpagecount then%>
<FONT
face=webdings><span style="color: #FF0000">:</span></font>
<%else%>
<a href=xinhunf.asp?page=<%=maxpagecount%>&lm="&lm&" title="尾页"><FONT
face=webdings><span >:</span></font></a>
<%end if%>
页次:<font color=red><%=page%></font>/<%=maxpagecount%>页
</table>
<%end sub '定义过程结束
'==========分页过程结束%>
如何把这个代码改成多列显示,现在是1列显示,谢谢指导
<tr>
<td align="center" valign="top" width="580" colspan="2">
<% '=============打开数据库表,要以这种方式打开
set rs=server.CreateObject("adodb.recordset")
rs.open "select id,title,content,timefrom [News] where lm='1' order by id desc",conn,1,1
if rs.bof and rs.eof then
response.write"暂无信息"
response.end
end if
%>
<%'=============分页定义开始,要放在数据库打开之后
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description
err.clear
else
if not (rs.eof and rs.bof) then '检测记录集是否为空
r=cint(rs.RecordCount) '记录总数
rowcount = 20 '设置每一页的数据记录数,可根据实际自定义
rs.pagesize = rowcount '分页记录集每页显示记录数
maxpagecount=rs.pagecount '分页页数
page=request.querystring("page")
if page="" then
page=1
end if
rs.absolutepage = page
rcount1=0
pagestart=page-9
pageend=page+9
if pagestart<1 then
pagestart=1
end if
if pageend>maxpagecount then
pageend=maxpagecount
end if
rcount=rs.RecordCount
'=============分页定义结束%>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<%'===========循环体开始
do while not rs.eof and rowcount%>
<table width="600" border="0" align="center" cellpadding="2" cellspacing="1">
<tr <%if icolor=0 then response.write"bgColor=#FFFAFC" else response.write"bgColor=#ffffff" end if%>>
<td width="100%"><div align="left"> · <a href=/news_view.asp?newsid=<%=rs("id")%> >
<%=left(rs("title"),50)%>
<% if len(rs("title"))>=50 then%>
…
<%end if%>
</a></div></td>
</tr>
</table>
<%
rowcount=rowcount-1
rs.movenext
icolor=icolor+1
if icolor>1 then icolor=0
loop
end if
end if
'===========循环体结束%>
</td>
</tr>
</table>
<%'===========显示分页的过程调用,要放在数据库打开后、释放资源前
call listPages()
rs.close '释放资源
set rs=nothing%>
<%'==========分页过程开始,也可单独创建一文件在本文件前包含调用
sub listPages() '定义过程开始%>
</td>
</tr>
<tr align="left">
<td bgcolor=#E4E4E4 >
<%if pagestart=1 then%>
<FONT face=webdings><span style="color: #FF0000"> 9</span></font>
<%else%>
<a href=xinhunf.asp?page=1&lm="&lm&" title="首页"><FONT
face=webdings><span >9</span></font></a>
<%end if%>
<% for i=pagestart to pageend
if i=0 then
i=1
end if
strurl="<a href=xinhunf.asp?page="&i&"&lm="&lm&" title='到"&i&"页'>"&i&"</a>"
response.write strurl
response.write " "
next
%>
<%if pageend=maxpagecount then%>
<FONT
face=webdings><span style="color: #FF0000">:</span></font>
<%else%>
<a href=xinhunf.asp?page=<%=maxpagecount%>&lm="&lm&" title="尾页"><FONT
face=webdings><span >:</span></font></a>
<%end if%>
页次:<font color=red><%=page%></font>/<%=maxpagecount%>页
</table>
<%end sub '定义过程结束
'==========分页过程结束%>
如何把这个代码改成多列显示,现在是1列显示,谢谢指导