asp初学者必看分页程序
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!--#include file="conn/conn.asp"-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>---</title>
<style type="text/css">
<!--
body {
background-color: #ECE9D8;
margin-left: 10px;
margin-top: 2px;
margin-right: 10px;
margin-bottom: 0px;
background-image: url(need_images/bg.jpg);
}
input{
border-width:1px;
height:22;
background-color:#ffffff;
border-color:#000000;
}
html{
font-size:12px;
scrollbar-face-color:#FFFFFF;
scrollbar-arrow-color:#cccccc;
scrollbar-track-color:#FFFFFF;
scrollbar-3dlight-color:#FFFFFF;
scrollbar-highlight-color:#fcfcfc;
scrollbar-shadow-color:##FFFFFF;
scrollbar-darkshadow-color:#FFFFFF
}
.title {
FONT-SIZE: 18px; COLOR: #010000; FONT-FAMILY: "黑体"
}
A:hover {
COLOR: #f18b01; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
TD {
FONT-SIZE: 9pt; COLOR: #666666; WORD-BREAK: break-all; LINE-HEIGHT: 170%; TEXT-DECORATION: none
}
.白字 {
COLOR: #ffffff
}
.company {
FONT-SIZE: 12px; COLOR: #2b2b2b; LINE-HEIGHT: 22px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.dot {
FONT-SIZE: 12px; COLOR: #aeaeae; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.news {
FONT-SIZE: 12px; COLOR: #515151; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.word {
FONT-SIZE: 12px; COLOR: #6f6f6f; LINE-HEIGHT: 18px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.caption_dark {
FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.caption_易做图 {
FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #ffffff; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.button {
FONT-SIZE: 12px; COLOR: #666666; TEXT-DECORATION: none
}
.date {
FONT-SIZE: 10px; COLOR: #acacac; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.doman {
FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #0a52af; FONT-FAMILY: Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.form {
BORDER-RIGHT: #e0e0e0 1px solid; BORDER-TOP: #e0e0e0 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #e0e0e0 1px solid; COLOR: #333333; BORDER-BOTTOM: #e0e0e0 1px solid; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #f7f7f7
}
.web_button {
FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #616e43; TEXT-DECORATION: none
}
.bbs_user {
FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #ff6600; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.bbs_user_易做图 {
FONT-SIZE: 12px; COLOR: #575757; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.menu {
FONT-SIZE: 12px; COLOR: #e4e4e4; TEXT-DECORATION: none
}
.copright {
FONT-SIZE: 12px; COLOR: #333333; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.bt_word {
FONT-SIZE: 12px; COLOR: #333333; LINE-HEIGHT: 18px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.list {
FONT-SIZE: 12px; COLOR: #424242; FONT-FAMILY: "??"; TEXT-DECORATION: none
}
.list_class {
FONT-SIZE: 12px; COLOR: #808080; FONT-FAMILY: "???"; TEXT-DECORATION: none
}
.page {
FONT-SIZE: 12px; COLOR:#000000; TEXT-DECORATION: none
}
.bbs_bt {
FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #000000; TEXT-DECORATION: none
}
.bbs_bt_易做图 {
FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #545454; TEXT-DECORATION: none
}
.bbs_list_word {
FONT-SIZE: 12px; COLOR: #171717; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.case {
FONT-SIZE: 12px; COLOR: #5a5e61; LINE-HEIGHT: 18px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.date_易做图 {
FONT-SIZE: 10px; COLOR: #666666; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.product_bt {
FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #333333; LINE-HEIGHT: 16px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.prodcut {
FONT-SIZE: 12px; COLOR: #505050; LINE-HEIGHT: 16px; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.form2 {
BORDER-RIGHT: #989898 1px solid; BORDER-TOP: #989898 1px solid; FONT-SIZE: 12px; BORDER-LEFT: #989898 1px solid; COLOR: #333333; BORDER-BOTTOM: #989898 1px solid; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; BACKGROUND-COLOR: #f6f6f6
}
.button3 {
FONT-SIZE: 12px; COLOR: #7b7b7b; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; TEXT-DECORATION: none
}
.bt1 {
FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #717171
}
.bt_line {
FONT-SIZE: 14px; COLOR: #547db2; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
.bt2 {
FONT-WEIGHT: bold; FONT-SIZE: 12px; COLOR: #ff9501; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif
}
A.nav:link {
FONT-SIZE: 12px; COLOR: #ffffff; TEXT-DECORATION: none
}
A.nav:visited {
FONT-SIZE: 12px; COLOR: #ffffff; TEXT-DECORATION: none
}
A.nav:hover {
FONT-SIZE: 12px; COLOR: #ffff00; TEXT-DECORATION: none
}
<font face="Verdana, Arial, Helvetica, sans-serif">
.sb{color:#000000;font-size:13px;text-decoration:none}
a.sb:visited{color:#6699FF;font-size:13}
a.sb:link{color:#3399CC;font-size:13px}
.tomg { color:#009966; font-size:12px; text-decoration:none}
a.tomg:link {color:#006699; text-decoration:none}
a.tomg:visited {color: #006699; text-decoration:none}
a.tomg:hover { color:#FF3300; font-size:12px;text-decoration:none}
.00 { color:#333333; font-size:12px; text-decoration:none}
a.00:hover { color: #FF6666; text-decoration:underline}
a.00:link {color: #666666; text-decoration:none}
a.00:visited {color: #000000; text-decoration:none}
a.bb:link {color:#666666; text-decoration:none;cursor:hand;font-weight:bold}
a.bb:visited {color: #666666; text-decoration:none;cursor:hand;font-weight:bold}
a.bb:hover {color: #CC0000; text-decoration:underline;cursor:hand;font-weight:bold}
.cc{color:#FFFFFF;font-size:12px;text-decoration:none}
.tomg1 { color: #000000; font-size:12px;text-decoration:none}
a.tomg1:link {color: #000000; text-decoration:none}
a.tomg1:visited {color: #000000; text-decoration:none}
a.tomg1:hover { color:#99CC33 ; text-decoration:none}
.style1 {
font-family: Georgia, "Times New Roman", Times, serif;
font-weight: bold;
}
.style3 {font-family: Georgia, "Times New Roman", Times, serif; font-weight: bold; font-size: 8pt; }
-->
</style>
</head>
<body>
<table width="800" height="146" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><iframe height="146" width="800" frameborder="0" hspace="0" align="middle" scrolling="no" src="need_top.asp"></iframe></td>
</tr>
</table>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="10" colspan="4" align="center" valign="top" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td width="190" height="300" rowspan="2" align="center" valign="top" bgcolor="#FFFFFF"><br />
<iframe height="600" width="200" frameborder="0" hspace="0" align="middle" scrolling="no" src="need_left.asp"></iframe>
</td>
<td width="2" rowspan="3" background="need_images/d_line_02.gif" bgcolor="#FFFFFF"></td>
<td colspan="2" align="center" valign="top" bgcolor="#FFFFFF"><table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
</tr>
</table>
<table width="95%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="2%" align="right"><img src="images/ymleft(1).jpg" width="9" height="27" /></td>
<td width="27%" align="left" background="images/ymcenter(1).jpg"><span class="caption_dark"> 网站模板 |</span> <span class="bbs_user">WEB</span></td>
<td width="21%" align="left" background="images/tongyongwangzhi-back-5.jpg"><img src="images/ymright(1).jpg" width="15" height="27" /></td>
<td width="24%" background="images/tongyongwangzhi-back-5.jpg"> </td>
<td width="26%" align="right" background="images/tongyongwangzhi-back-5.jpg"> </td>
</tr>
</table>
<table width="95%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="1" colspan="3" background="need_images/d_line_01.gif"></td>
</tr>
<%dim sqlmb,page,i
i=0
sqlmb="select * from webmb order by id desc "
call opendb
rs.open sqlmb,conn,1,1
if not rs.eof then
page=cint(request.querystring("page"))
if page=0 then
page=1
end if
rs.pagesize=15
if not isnumeric(page) or page<0 or page>rs.pagecount or page="" then
rs.absolutepage=1
else
rs.absolutepage=page
end if
end if%>
<tr bgcolor="#FFFFFF">
<td height="15" colspan="3"></td>
</tr>
<tr align="center" valign="bottom" bgcolor="#FFFFFF">
<%
do while not rs.eof and i<rs.pagesize
i=i+1
%>
<td width="200" height="137" valign="top" bgcolor="#FFFFFF"> <br>
<img src="<%=rs("mb_image")%>" width="143" height="95" border="1" class="tomg" style="border-color:#DDDDDD; " />
<%response.write("<br><br>"&rs("mb_name"))%>
</td>
<% if i mod 3=0 then%>
<td width="389"></td>
</tr>
<tr bgcolor="#FFFFFF" >
<td height="13" align="center" class="web_button"></td>
<td height="13" align="center" class="web_button"></td>
</tr>
<tr >
<td height="1" colspan="2" align="center" class="web_button"></td>
</tr>
<% end if
rs.movenext
loop
%>
</table>
</td>
</tr>
<tr>
<td colspan="2" align="center" valign="bottom" bgcolor="#FFFFFF"><table width="98%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
<tr>
<td height="25" align="center" bgcolor="#F5F5F5"><span class="tomg1">共<%=rs.recordcount%>条 共<%=rs.pagecount%>页 第<%=page%>页 当前<%=i%>条
<%'if rs.pagecount>1 then%>
<a href="<%=request.ServerVariables("SCRIPT_NAME")%>?page=1" class="tomg1">首页</a> <a href="<%=request.ServerVariables("SCRIPT_NAME")%>?page=<%=rs.pagecount%>" class="tomg1">末页</a>
<% if page>0 then%>
<a href="<%=request.ServerVariables("SCRIPT_NAME")%>?page=<%=page-1%>" class="tomg1">上一页</a>
<%end if
if page>0 then%>
<a href="<%=request.ServerVariables("SCRIPT_NAME")%>?page=<%=page+1%>" class="tomg1">下一页</a></span> </td>
<%end if
'end if
call closedb()%>
</tr>
</table></td>
</tr>
<tr align="center" bgcolor="#FFFFFF">
<td height="20" colspan="3"></td>
</tr>
<tr bgcolor="#FFFFFF" background="need_images/d_line_01.gif">
<td bgcolor="#FFFFFF" height="2" colspan="3"></td>
</tr>
</table>
<table width="800" height="104" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="93" width="800"><iframe height="103" width="800" frameborder="0" hspace="0" align="middle" scrolling="no" src="bottom.htm"></iframe>
</td>
</tr>
</table>
</body>
</html>
补充:asp教程,ASP入门