📄 gbook.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="inc/char.inc"-->
<!--#include file="include.asp"-->
<HTML>
<HEAD>
<TITLE>
<%
If WebTitle="" Then
Response.Write WebName
Else
Response.Write WebName&" --> "&WebTitle
End if
%>
</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="keywords" content="<%=W_WebSiteKeyword%>">
<meta name="description" content="<%=W_WebSiteIntr%>">
<LINK href="css.css" type="text/css" rel="stylesheet">
<style type="text/css">
<!--
.style3 {color: #666666}
.alpha {filter: Alpha(Opacity=65)}
-->
</style>
<script language="JavaScript" src="images/js.js"></script>
</head>
<% If Request("i")="show" Then %>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style>
<body STYLE="background-color:transparent" onLoad="MM_preloadImages('images/index_03_011.gif','images/index_03_021.gif','images/index_03_031.gif','images/index_03_041.gif','images/index_03_051.gif','images/index_03_061.gif')">
<script language="JavaScript1.2">
iens6=document.all||document.getElementById
ns4=document.layers
//specify speed of scroll (greater=faster)
var speed=10
if (iens6){
document.write('<div id="container" style="position:relative;width:600;height:410;border:0px solid black;overflow:hidden">')
document.write('<div id="content" style="position:absolute;width:590;left:0;top:0">')
}
</script>
<ilayer name="nscontainer" width=600 height=430 clip="0,0,500,160">
<layer name="nscontent" width=600 height=430 visibility=hidden>
<%
const MaxPerPage=8 '单独页最大记录数 const 用来申明常量
dim sql
dim rs
dim totalPut '总记录
dim CurrentPage '当前页次
dim TotalPages '总页数
dim i
dim id
%>
<%
set rs=server.createobject("adodb.recordset")
If BookExamine=False Then
sql="select * from book order by id desc"
Else
sql="select * from book where bexamine=true order by id desc"
End If
rs.open sql,Conn,1,1
%>
<%
if rs.eof and rs.bof then
%>
<table width="522" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#333333">
<tr>
<td align="center">暂时还没有任何留言!</td>
</tr>
</table>
<%
else
%>
<!-- 分页功能代码块,可独立使用 -->
<%
if not rs.eof then
rs.MoveFirst '注意放到前面来,否则到任何页总是在第一个记录上
end if
rs.pagesize=MaxPerPage '设置每页最多显示多少条记录
If trim(Request("Page"))<>"" then '如果请求的页次不为空
If IsNumeric(trim(Request("Page"))) = False Then
GoError "分页参数错误,请不要试图破坏此系统。"
End If
CurrentPage= CLng(request("Page")) 'clng是转换成长整型数据类型,并赋值到当前页次上
If CurrentPage> rs.PageCount then '如果当前页次大于总页数,则将最大页次赋值到当前页次上
CurrentPage = rs.PageCount
End If
Else
CurrentPage= 1 '一切条件不成立,将当前页设为第一页
End If
totalPut=rs.recordcount '将总记录赋值于TOTALPUT
if CurrentPage<>1 then '如果当前页数不等于第一页
if (currentPage-1)*MaxPerPage<totalPut then '如果当前页减一乘以每页最大的记录数小于总记录的话
rs.move(currentPage-1)*MaxPerPage '相对当前记录数向后移动
dim bookmark '定义书签变量
bookmark=rs.bookmark '将当前记录的标签赋于变量BOOKMARK上
end if
end if
dim n,k
if (totalPut mod MaxPerPage)=0 then '总记录数与每页最大记录数求余的结果为零时,则N返回整数页次,否则再加一.
n= totalPut \ MaxPerPage
else
n= totalPut \ MaxPerPage + 1
end if
%>
<!-- 将RS记录指针指向第一个记录,然后开始判断移动记录时,记录结尾是否为空,如果不为空接着移动指针,把所有数据都读取出来。直到结尾为空时,退出循环 -->
<%
id=(totalPut-MaxPerPage*(currentPage-1))+1
i=0
Do While Not rs.EOF and i<MaxPerPage
id=id-1
%>
<table width="95%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#333333" class="alpha">
<tr>
<td width="110" align="center">【第<%=id%>位】</td>
<td><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="54">发表于:</td>
<td width="246" align="left"><%=rs("time")%></td>
<td width="30"></td>
<td width="30"></td>
<td width="30"></td>
<td width="30" align="center"><img src="images/friend.gif" alt="来自:<%=rs("where")%>" width="18" height="18" /></td>
<td width="30" align="center"><img src="images/ip.gif" alt="IP:<%=rs("ip")%>" width="18" height="18" /></td>
</tr>
</table></td>
</tr>
<tr bgcolor="#666666">
<td height="1" colspan="3" ></td>
</tr>
<tr>
<td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
<tr>
<td align="center"><img src="<%=rs("pic")%>" width="75" height="75" /></td>
</tr>
<tr>
<td height="35" align="center"><strong><%=rs("name")%></strong></td>
</tr>
</table>
</td>
<td valign="top"><table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="7%"></td>
<td width="38%"> <%if rs("show")=2 then
response.write"此留言内容为悄悄话,只有管理员才可查看!"
%> <%else%> </td>
</tr>
<tr valign="top">
<td height="60" colspan="2"><%=rs("content")%> <%end if%> </td>
</tr>
</table> <%
if rs("reply")<>"" then%>
<table width="80%" border="0" align="right" cellpadding="0" cellspacing="0">
<tr>
<td align="center"><span class="style3">----------------------------------------------------------</span></td>
</tr>
<tr>
<td class="style5">站长回复:<%=htmlencode(rs("reply"))%></td>
</tr>
</table> <%end if%> </td>
</tr>
</table>
<br>
<% i=i+1
rs.movenext
loop
%>
<table align="center" >
<tr>
<td><br />
<div align="center">当前第 <font color="#FFFF00"><%=currentpage%></font> 页 总共 <font color="#FFFF00"><%=n%></font> 页 共 <font color="#FFFF00"><%=rs.recordcount%></font> 个留言
<%k=currentPage
if k<>1 then
response.write "[<b>"+"<a href='?i=show&page=1'>首页</a></b>] "
response.write "[<b>"+"<a href='?i=show&page="&cstr(k-1)&"'>上一页</a></b>] "
else
Response.Write "[首页] [上一页]"
end if
if k<>n then
response.write "[<b>"+"<a href='?i=show&page="&cstr(k+1)&"'>下一页</a></b>] "
response.write "[<b>"+"<a href='?i=show&page="&cstr(n)&"'>尾页</a></b>] "
else
Response.Write "[下一页] [尾页]"
end if
%>
</td>
</tr>
</table>
</layer>
</ilayer>
<script language="JavaScript1.2">
if (iens6)
document.write('</div></div>')
</script>
<table width="96%"><td><p align="right">
|<a href="#" onMouseover="moveup()" onMouseout="clearTimeout(moveupvar)">
向上
</a>|<a href="#" onMouseover="movedown()" onMouseout="clearTimeout(movedownvar)">
向下
</a>|</p></td>
</table>
<script language="JavaScript1.2">
if (iens6){
var crossobj=document.getElementById? document.getElementById("content") : document.all.content
var contentheight=crossobj.offsetHeight
}
else if (ns4){
var crossobj=document.nscontainer.document.nscontent
var contentheight=crossobj.clip.height
}
function movedown(){
if (iens6&&parseInt(crossobj.style.top)>=(contentheight*(-1)+100))
crossobj.style.top=parseInt(crossobj.style.top)-speed
else if (ns4&&crossobj.top>=(contentheight*(-1)+100))
crossobj.top-=speed
movedownvar=setTimeout("movedown()",100)
}
function moveup(){
if (iens6&&parseInt(crossobj.style.top)<=0)
crossobj.style.top=parseInt(crossobj.style.top)+speed
else if (ns4&&crossobj.top<=0)
crossobj.top+=speed
moveupvar=setTimeout("moveup()",100)
}
function getcontent_height(){
if (iens6)
contentheight=crossobj.offsetHeight
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -