您现在的位置: 万盛学电脑网 >> 程序编程 >> 网络编程 >> asp.net编程 >> 正文

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

作者:佚名    责任编辑:admin    更新时间:2022-06-22

 这是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