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

(编辑:jimmy 日期: 2025/4/22 浏览:2)

这是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>" 
else 
ref=ref&"<a href=list_"&j-1&".html"&">" & "<FONT face=Webdings>7</FONT>" & "</a> " 
end if 

for counter=1 to totalpage 
ref=ref&"<a href=list_"&counter&".html"&">[" & counter & "]</a>" 
ref=ref& " " 
if counter mod 10 = 0 then 
ref=ref& "<br>" 
end if 
next 

if (whichpage>totalpage or whichpage=totalpage) then 
ref=ref&"<FONT face=Webdings>8</FONT>" 
else 
ref=ref&"<a href=list_"&j+1&".html"&">" & "<FONT face=Webdings>8</FONT>" & "</a> " 
end if 
ref=ref&"<a href=list_"&totalpage&".html"&">" & "<FONT face=Webdings>:</FONT>" & "</a> " 

Dim fso,f 
Dim strTitle,strContent,strOut 
'创建文件系统对象 
Set fso=Server.createObject("Scripting.FileSystemObject") 
Set f=fso.createTextFile(Server.MapPath("list_"&j&".html"),true) 

'写入网页内容 
f.WriteLine strHead&str0&ref 
f.close 
response.write "正在生成第"&j&"个页面!<br>" 
%><% 
next%>
一句话新闻
一文看懂荣耀MagicBook Pro 16
荣耀猎人回归!七大亮点看懂不只是轻薄本,更是游戏本的MagicBook Pro 16.
人们对于笔记本电脑有一个固有印象:要么轻薄但性能一般,要么性能强劲但笨重臃肿。然而,今年荣耀新推出的MagicBook Pro 16刷新了人们的认知——发布会上,荣耀宣布猎人游戏本正式回归,称其继承了荣耀 HUNTER 基因,并自信地为其打出“轻薄本,更是游戏本”的口号。
众所周知,寻求轻薄本的用户普遍更看重便携性、外观造型、静谧性和打字办公等用机体验,而寻求游戏本的用户则普遍更看重硬件配置、性能释放等硬核指标。把两个看似难以相干的产品融合到一起,我们不禁对它产生了强烈的好奇:作为代表荣耀猎人游戏本的跨界新物种,它究竟做了哪些平衡以兼顾不同人群的各类需求呢?