共有2342人关注过本帖树形打印

主题:首页显示篇

帅哥哟,离线,有人找我吗?
gaofeng
  1楼 个性首页 | QQ | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:管理员 帖子:3510 积分:11231 威望:5 精华:7 注册:2000-5-19 10:19:38
首页显示篇  发帖心情 Post By:2014-2-18 16:33:32

index.asp

'读入数据库链接!
<!--#include file="articleconn.asp"-->
<html>
<%
'每页最大显示数为20
const MaxPerPage=20
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j

dim typename
dim keyword
keyword=trim(request("keyword"))

if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if

%>
<head>
<meta http-equiv="Content-Type" c>
<title>ASP动感在线</title>
<meta name="GENERATOR" c>
<link rel="stylesheet" href="../css/style.css">
</head>
<body bgcolor="#FFFFFF">
<table width="90%" cellpadding="0" cellspacing="0" align="center">
<tr>
<td colspan="3" height="203">
<table border="1" width="100%" bordercolorlight="#000000" bordercolordark="#FFFFFF" cellpadding="0" cellspacing="0" align="center">
<tr bgcolor="#ACD6FF">
<td width="100%" height="20">
<p align="center"><font color="#000000"><b>站 务 公 告</b></font>
</td>
</tr>
<tr>
<td width="100%" height="152">
<form method="post" action="index.asp">
<br>
<font color="#FF0000"> </font>
<table border=0 cellpadding=0 cellspacing=0 width="54%" align="center">
<tr>
<td valign=center colspan="3" align="right">
<div align="center">查询关键字<font color="#FF0000"><%=keyword%></font>
</div>
</td>
</tr>
<tbody>
<tr>
<td width="27%" align="right">请输入搜索字符: </td>

<td valign=center width="54%" align="center">
<input class=TextBorder maxlength=25
name=keyword size=26>
  </td>
<td valign=buttom width="19%" align="left">
<input alt=站内搜索 border=0
name=submit src=http://www.163design.net/a/d/".images/search.gif" type=image>
</td>
</tr>
</tbody>
</table>
</form>
<p align="left"><%
'打开数据库内容安ARTICLEID的倒数排列!
'title like '%"&keyword&"%' 为对搜索字的查找,空者表示全部!
sql="select * from learning where title like '%"&keyword&"%' order by articleid desc"
dim sql,rs
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1

'判断数据库是否为空!如果为空显示'还 没 有 任 何 文 章'

if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 文 章</p>"
else
'下面是对文章数,每页显示数的判断!大家可作其它程序的参考!!
totalPut=rs.recordcount
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if

end if
if currentPage=1 then
showpage totalput,MaxPerPage,"index.asp"
showContent
showpage totalput,MaxPerPage,"index.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"inde


支持(0中立(0反对(0回到顶部