zoukankan      html  css  js  c++  java
  • 分页,静态程序asp实现,php同理

    多年前写的东西啦,拿出来充充门面,菜鸟可看,高手掠过!
     <!--#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"">"&amp;rs(0)"</td>"           
    str0=str0"<td bgcolor=#f7f7f7 align=""center"">"&amp;rs(1)"</td>"           
    str0=str0"<td bgcolor=#f7f7f7 align=""center"">"&amp;rs(2)"</td>"           
    str0=str0"<td bgcolor=#f7f7f7 align=""center"">"&amp;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: " &amp; j &amp; " / " &amp; totalpage "</b>"           
    ref=ref"</td>"           
    ref=ref"<td> "           
               
    ref=ref"<a href=list_1.html"">" &amp; "<FONT face=Webdings>9</FONT>" &amp; "</a> "           
    if whichpage=1 then            
    ref=ref"<FONT face=Webdings>7</FONT>"           
    else            
    ref=ref"<a href=list_"&amp;j-1".html"">" &amp; "<FONT face=Webdings>7</FONT>" &amp; "</a> "           
    end if            
               
    for counter=1 to totalpage            
    ref=ref"<a href=list_"".html"">[" &amp; counter &amp; "]</a>"           
    ref=ref&amp; " "           
    if counter mod 10 = 0 then            
    ref=ref&amp; "<br>"           
    end if            
    next            
               
    if (whichpage>totalpage or whichpage=totalpage) then            
    ref=ref"<FONT face=Webdings>8</FONT>"           
    else            
    ref=ref"<a href=list_"&amp;j+1".html"">" &amp; "<FONT face=Webdings>8</FONT>" &amp; "</a> "           
    end if            
    ref=ref"<a href=list_"".html"">" &amp; "<FONT face=Webdings>:</FONT>" &amp; "</a> "           
               
    Dim fso,f            
    Dim strTitle,strContent,strOut            
    '创建文件系统对象            
    Set fso=Server.CreateObject("Scripting.FileSystemObject")            
    Set f=fso.CreateTextFile(Server.MapPath("list_"".html"),true)            
               
    '写入网页内容            
    f.WriteLine strHead&amp;str0&amp;ref            
    f.close            
    response.write "正在生成第""个页面!<br>"           
    %>            
    <%            
    next    
    %>
  • 相关阅读:
    MapReduce —— MapTask阶段源码分析(Output环节)
    MapReduce——移动数据不如移动计算
    MapReduce —— MapTask阶段源码分析(Input环节)
    MapReduce——客户端提交任务源码分析
    NameNode和SecondaryNameNode角色功能分析
    线程的实现原理
    RTFSC:SpringBoot 源码惊鸿一瞥
    垃圾收集器学习笔记
    常见的六种OOM异常和错误
    简单类型多线程加锁
  • 原文地址:https://www.cnblogs.com/fancing/p/1690817.html
Copyright © 2011-2022 走看看