?? teacherinfo.asp
字號:
<!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,td,th {
font-size: 14px;
color: #003399;
}
.style1 {
font-size: 24px;
font-weight: bold;
color: #003366;
font-family: "華文行楷";
}
a:link {
color: #003399;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #003399;
}
a:hover {
text-decoration: none;
color: #003399;
}
a:active {
text-decoration: none;
color: #003399;
}
-->
</style></head>
<body>
<!--#include virtual="../inc/head.htm"-->
<p></p>
<table width="80%" border="1">
<tr>
<th scope="col">求職信息的內容</th>
<th scope="col">發(fā)布時間</th>
<th scope="col">發(fā)布人</th>
</tr>
<%
Set conn=Server.CreateObject("ADODB.Connection")
conn.ConnectionString="Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Server.MapPath("db/info.mdb")
conn.Open
strSql="select content,puttime,nick from teacherinfo order by puttime desc" 'SQL語句,從teacherinfo表中查詢家教發(fā)布的信息內容,發(fā)布時間和昵稱
Set rs=Server.CreateObject("ADODB.Recordset")
rs.open strSql,conn,1,3
rs.PageSize=5
Page=1 '設置變量Page用來表示當前頁號
if Not IsEmpty(Request("Page")) then '判斷Page是否已經(jīng)初始化...
Page=CInt(Request("Page")) '接收Page并化為數(shù)字型賦給Page變量
if Page > rs.PageCount then '如果接收的頁數(shù)大于總頁數(shù)
rs.AbsolutePage = rs.PageCount '設置當前顯示頁為末頁
else
rs.AbsolutePage = Page '顯示當前頁等于接收的頁數(shù)
end if
else
Page = 1 '如果page未被初始化則設為1
End if
rs.AbsolutePage=Page
For i=1 To rs.PageSize '利用for next 循環(huán)依次讀出記錄
if rs.EOF then
Exit For
End If
Response.Write("<tr><td>" & rs("content") & "<td>" & rs("puttime") &_
"<td><a href='teacherdetail.asp?name=" & rs("nick") & "'>" & rs("nick") & "</a>" )
rs.MoveNext
Next
%>
</table>
<p>
<div align="center">
<%
if Page>1 then
Response.Write("<a href='teacherinfo.asp?Page=1'>首頁</a> ")
Response.Write("<a Href='teacherinfo.asp?Page=" & (Page-1) & "'> 上一頁 </a> ")
end if
if Page< rs.pagecount then
Response.Write("<a href='teacherinfo.asp?Page=" & (Page+1) & "'> 下一頁 </a> ")
Response.Write("<a href='teacherinfo.asp?Page=" & (rs.PageCount) & "'> 尾頁 </a>")
end if
%>
</div>
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -