加入收藏 | 设为首页 | 会员中心 | 我要投稿 银川站长网 (https://www.0951zz.com/)- 云通信、基础存储、云上网络、机器学习、视觉智能!
当前位置: 首页 > 站长学院 > Asp教程 > 正文

asp分页组成html的程序脚本代码

发布时间:2023-07-29 13:06:39 所属栏目:Asp教程 来源:
导读:这是asp分页列表生成静态页面得asp小程序脚本代码如下:<!--#include file="conn.asp"--> <html><head><TITLE>分页测试</TITLE><LINK href="inc/style.css" type=text/css rel=stylesheet></head> <%strHead=strHead&

这是asp分页列表生成静态页面得asp小程序脚本

代码如下:

<!--#include file="conn.asp"--> 

<html><head><TITLE>分页测试</TITLE><LINK href="inc/style.css" type=text/css rel=stylesheet></head> 

<%strHead=strHead&"<html>" 

strHead=strHead&"<head>" 

strHead=strHead&"<TITLE>分页测试</TITLE>" 

strHead=strHead&"<LINK href=""inc/style.css"" type=text/css rel=stylesheet>" 

strHead=strHead&"</head>" 

%> 

<%  

sql="select * from news" 

set rs=server.createObject("ADODB.Recordset") 

rs.open sql,conn,1,1 

%><% 

rs.pagesize=2 

totalpage=rs.pagecount 

rs.close 

set rs=nothing 

for j=1 to totalpage 

sql="select * from news" 

set rs=server.createObject("ADODB.Recordset") 

rs.open sql,conn,1,1 

whichpage=j  

rs.pagesize=2 

totalpage=rs.pagecount 

rs.absolutepage=whichpage 

howmanyrecs=0 

%><% 

str0="" 

str0=str0&"</p>" 

str0=str0&"<table bgcolor=#cecfce align=center border=0 width=800 cellpadding=2 cellspacing=1>" 

%><%  

do while not rs.eof and howmanyrecs<rs.pagesize 

%><% 

str0=str0&"<tr bgcolor=#f7f7f7>" 

str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(0)&"</td>" 

str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(1)&"</td>" 

str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(2)&"</td>" 

str0=str0&"<td bgcolor=#f7f7f7 align=""center"">"&rs(3)&"</td>" 

str0=str0&"</tr>" 

%><% 

rs.movenext 

howmanyrecs=howmanyrecs+1 

loop 

rs.close 

set rs=nothing 

%><%str0=str0&"</table>" 

%><% 

'分页部分 

ref="" 

ref=ref&"<br>" 

ref=ref&"<table bgcolor=#cecfce align=center border=0 width=800 cellpadding=0 cellspacing=1> " 

ref=ref&"<tr bgcolor=#f7f7f7>" 

ref=ref&"<td> " 

ref=ref&"<b>Pages: " & j & " / " & totalpage &"</b>" 

ref=ref&"</td>" 

ref=ref&"<td> " 

ref=ref&"<a href=list_1.html"&">" & "<FONT face=Webdings>9</FONT>" & "</a> " 

if whichpage=1 then 

ref=ref&"<FONT face=Webdings>7</FONT>" 

(编辑:银川站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章