首页显示篇

80酷酷网    80kuku.com

  显示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" content="text/html; charset=gb2312">
<title>ASP动感在线</title>
<meta name="GENERATOR" content="Microsoft FrontPage 3.0">
<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">


<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

分享到
  • 微信分享
  • 新浪微博
  • QQ好友
  • QQ空间
点击: