煤气报警器什么牌子好:我这个ASP如何做一个分页

来源:百度文库 编辑:杭州交通信息网 时间:2024/04/29 05:05:34
<!--#include file="conn.asp"-->
<%
dim Rs
set Rs=server.createobject("adodb.recordset")
query="select*from guestbook order by id DESC"
Rs.Open query,Conn,3,3
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>留言列表</title>
<style type="text/css">
<!--
body {
background-image: url();
}
-->
</style></head>
<body>
<p><a href="gbpost.asp">返回留言</a></p>
<table width="100%" border="1" cellpadding="0" cellspacing="0">
<tr align="center"valign="middle">
<td width="25%" >留言者</td>
<td width="40%" >主题</td>
<td width="25%" >日期</td>
<td width="10%" >操作</td>
</tr>
<%
i=1
while not Rs.EOF
%>
<tr>
<td width="25%"><div align="center"><%=Rs("Poster")%></div></td>
<td width="40%"><div align="center"><a href="gbcontent.asp?ID=<%=Rs("ID")%>"title="<%=Rs("Title")%>"> <%=Rs("Title")%></a></div></td>
<td width="25%"align="center"><%=Rs("time")%></td>
<td width="10%"align="center"><a href="gbdelete.asp?ID=<%=Rs("ID")%>"title="删除"> 删除</a></td>
</tr>
<%
Rs.MoveNext
i=i+1
wend
%>
</table>
</body>
</html>
<%rs.close
set rs = nothing%>

给位帮帮忙,急用啊!!

我写了个可以分页的留言页面,你参考一下
<html>
<head>
<title>留言</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<link href="css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style6 {
font-size: 12;
color: #8B7574;
}
.style8 {font-size: 12px; color: #856E6D; }
.style9 {
font-size: 14px;
font-weight: bold;
}
-->
</style>
</head>
<%@ language="vbscript"%>

<%
Function Deal(exp1)
dim exp2
exp2=Replace(exp1,"<","<")
exp2=Replace(exp2,">",">")
exp2=Replace(exp2,"'","''")
exp2=Replace(exp2,Chr(13),"<br>")
Deal=exp2
End Function%>

<!--#include file="sysinc.asp"-->
<%
If Request("task")="insert" then
If Request("xm")="" then
xm="不告诉你"
else
xm=Request("xm")
xm=Deal(xm)
end if
if request("email")="" then
email="还没有"
email=Deal(email)
else
email=Request("email")
end if
if request("url")="" then
url="没有"
else
url=Request("url")
url=Deal(url)
end if
sj = Date()
sj = sj & " " & Hour(Time()) & ":" & Minute(Time())
If Request("ly")="" then
Response.write("请输入留言!")
Response.end
else
ly=Request("ly")
ly=Deal(ly)
end if
sql="INSERT INTO lyb (ip,xm,url,email,sj,ly) VALUES ('"
sql=sql & Request("REMOTE_ADDR") & "','" & xm & "','" & url & "','" & email & "','" & sj & "','" & ly & "')"
conn.execute(sql)
end if

set rs=server.createobject("adodb.recordset")
on error resume next
rs.open "select * from lyb order by sj DESC",conn,1,1
rs.pagesize=10
rs.AbsolutePage =1
if request("page")<>"" then rs.AbsolutePage =Request("page")
RowCount =rs.pagesize
%>

<body background="img/beijing.gif">

<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0" background="img/beijing1.jpg">
<!--DWLayoutTable-->
<tr>
<td width="800" height="61" valign="top"><!--#include file=top.asp--></td>
</tr>
</table>
</div>
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0" background="img/beijing1.jpg" bgcolor="#ffffff">
<!--DWLayoutTable-->
<tr>
<td height="28" colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="8" height="28"> </td>
<td width="260" valign="middle"><span class="style6">您当前的位置:首页>>请您留言</span></td>
</tr>
</table></td>
<td width="365"> </td>
<td width="167"> </td>
</tr>
<tr>
<td width="178" height="538"> </td>
<td colspan="2" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="455" height="538" valign="top" class="style8"><p class="style9"><font face="楷体_GB2312"><big><big><big>
<hr color="#999999">  留言薄 </big></big></big></font></p> <form METHOD="POST" action="<%=Request("SCRIPT_NAME")%>">
<input type="hidden" name="task" value="insert">
<p> 姓名:
<input TYPE="text" SIZE="20" NAME="xm" style="background-color:#DFD5D6 ">
<br>
邮件:
<input TYPE="text" SIZE="20" NAME="email" style="background-color:#DFD5D6 ">
<br>
主页:
<input TYPE="text" SIZE="20" NAME="url" style="background-color:#DFD5D6 ">
<br>
留言:<br>
<textarea ROWS="5" COLS="60" NAME="ly" style="background-color:#DFD5D6 ">
</textarea>
</p>
<p>
<input TYPE="submit" VALUE="留言" NAME="B1" style="background-color:#856E6D ">
<input TYPE="reset" VALUE="重写" NAME="B2" style="background-color:#856E6D ">
</p>
</form> <hr color="#999999">
<%
if not rs.eof then
Do While Not RS.EOF and RowCount>0
%>
<p>日期:<%=rs("sj")%><br>
<%
if rs("xm")<>"" then
%>
姓名:<%=rs("xm")%><br>
<%
end if
if rs("url")<>"" then
%>
主页:<a href="<%=rs("url")%>" class="link2"><%=rs("url")%></a><br>
<%
end if
if rs("email")<>"" then
%>
邮件:<a href="mailto:<%=rs("email")%>" class="link2"><%=rs("email")%></a><br>
<%
end if
%>
留言:<br>
<%=rs("ly")%></p> <hr color="#999999">
<%
RowCount = RowCount - 1
rs.movenext
loop
else
response.write("留言本空")
end if
%>
<%
if rs.pagecount>1 then
%>
<table border="0">
<tr>
<td class="style8">留言分页</td>
<%
for i=1 to rs.pagecount
%>
<td class="style8"><a href="<%=Request("Script_Name")%>?page=<%=i%>" class="link2"><b><%=i%></b></a></td>
<%next%>
</tr>
</table> <%
end if
rs.close
Set rs=nothing
conn.close
Set conn=nothing
%></td>
</tr>
</table></td>
<td> </td>
</tr>
<tr>
<td height="53"> </td>
<td width="90"> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
<div align="center">
<table width="800" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td width="800" height="70" valign="top"><!--#include file=foot.asp--></td>
</tr>
</table>
</div>
</body>
</html>