标题: asp如何设置二列显示 [打印本页] 作者: oulujie 时间: 2011-2-17 10:17 标题: asp如何设置二列显示 <table width="400px" border="0" align="center" cellpadding="4" cellspacing="1" class="border1">
<tr bgcolor="#336699">
<td colspan="4" bgcolor="#336699" class="font_wihe">信息列表</td>
</tr>
<tr bgcolor="#99CCFF" class="font_black1">
<td width="100%" colspan="2" bgcolor="#99CCFF"><div align="center"><span class="style7">信息名称</span></div></td>
</tr>
<%
set ptr1=server.CreateObject("adodb.recordset")
sql="Select * from help_news order by id desc"
ptr1.open sql,conn,1,1
if ptr1.recordcount<>0 then
ptr1.pagesize=20
page=clng(request.QueryString("page"))
if page<1 then page=1
if page>ptr1.pagecount then page=ptr1.pagecount
ptr1.absolutepage=page
for i = 1 to ptr1.pagesize
n=n+1
if len(ptr1("title"))>20 then
title=left(ptr1("title"),20)&"..."
else
title=ptr1("title")
end if
%>
<tr bgcolor="#99CC99">
<td bgcolor="#99CC99"><%=title%></td>
<td bgcolor="#99CC99"><%=FormatDateTime(ptr1("date"),2)%></td>
</tr>
<% ptr1.movenext
if ptr1.eof then exit for
next
%>
<tr bgcolor="#99CCFF">
<td colspan="9">
<%
if page=1 then
response.Write("首页")
else
response.Write("<a href=?page=1"">首页</a>")
end if
if page=1 then
response.Write(" 上一页")
else
response.Write(" <a href=?page=" & page-1 & ">上一页</a>")
end if
if page=ptr1.pagecount then
response.Write(" 下一页")
else
response.Write(" <a href=?page=" & page+1 & ">下一页</a>")
end if
if page=ptr1.pagecount then
response.Write(" 末页")
else
response.Write(" <a href=?page=" & ptr1.pagecount & ">末页</a>")
end if
%>
<%=page%>/<%=ptr1.pagecount%>页 共<%=ptr1.recordcount%>条记录!</td>
</tr>
</table>