asp最常用的分页函数

复制代码 代码如下: rs.opensql,conn,1,1 ifrs.eofandrs.bofthen response.write'palign=''center''还没找到文章/p' else totalPut=rs.recordcount maxperpage=18 ifcurrentpage1then currentpage=1 endif if(currentpage-1

作者: 来源: 时间: 17-11-23 15:08:23

复制代码 代码如下:
    rs.open sql,conn,1,1
    if rs.eof and rs.bof then
     response.write "<p align=''center''>还没找到文章</p>"
  else
   totalPut=rs.recordcount
   maxperpage=18
   if currentpage<1 then
    currentpage=1
    end if
   if (currentpage-1)*maxperpage>totalput then
      if (totalput mod maxperpage)=0 then
      currentpage=totalput\maxperpage
      else
      currentpage=totalput\maxperpage+1
      end if
   end if
    if currentpage=1 then
    showpage1 totalput,maxperpage,"infotype.asp?id="&request("id")
    showcontent()
    showpage totalput,maxperpage,"infotype.asp?id="&request("id")
    else
       if (currentpage-1)*maxperpage<totalput then
       rs.move (currentpage-1)*maxperpage
       dim bookmark
       bookmark=rs.bookmark
       showpage1 totalput,maxperpage,"infotype.asp?id="&request("id")
       showcontent
       showpage totalput,maxperpage,"infotype.asp?id="&request("id")
       else
       currentpage=1
       showpage1 totalput,maxperpage,"infotype.asp?id="&request("id")
       showcontent
       showpage totalput,maxperpage,"infotype.asp?id="&request("id")
       end if
    end if 
end if
%>
<%
  sub showcontent()
  %>
  <tr>
    <td height="20" class="blueback2"><div align="center">ID</div></td>
    <td class="blueback2"><div align="center"><a href="javascript:selectall()"><font color="#FFFFFF">选择</font></a></div></td>
    <td width="355" class="blueback2"><div align="center">信息标题</div></td>
    <td width="84" class="blueback2"><div align="center">更新日期</div></td>
    <td width="40" class="blueback2"><div align="center">点击</div></td>
    <td width="55" class="blueback2"><div align="center">添加人</div></td>
    <td width="44" class="blueback2"><div align="center">编辑</div></td>
    <td width="43" class="blueback2"><div align="center">删除</div></td>
    <td width="62" class="blueback2"><div align="center">生成[<a href="javascript:void(null)" onClick="window.open(''cshengcheng.asp'','''',''width=0,height=0'')"><font color="#FFFFFF">归零</font></a>]</div></td>
  </tr>  
  <%

  i=1
   do while not rs.eof
%>

  <tr>
    <td width="39" height="25" bgcolor="#D6DFF7"><div align="center"><%=rs("id")%></div></td>
    <td width="34" bgcolor="#D6DFF7"><div align="center">
           <input type="checkbox" name="dxyid" value="http://www.popasp.com//"><font color="red">[首页]</font></a> <a href="http://www.popasp.com/&page="><font color="red">[上一页]</font></a>
        <%end if%><% if n-currentpage<1 then%>
        [下一页] [尾页]<%else%><a href="http://www.popasp.com/&page="><font color="red">[下一页]</font></a> <a href="http://www.popasp.com/&page="><font color="red">[尾页]</font></a>
        <%end if%>
        转到:<select name="dd" class="sle" 

onChange="location.href=http://www.popasp.com/this.options[this.selectedIndex].value">
     <%for j=1 to n
     if currentpage=j then
     %><option value="http://www.popasp.com/&page=" selected><%=j%></option>
     <%
     else
     %>
     <option value="http://www.popasp.com/&page="><%=j%></option>
     <%
     end if
     next
     %>
    </select>
    </div>    </td>
    </tr>
    <%
    end function
    %>
    <%
    function showpage1(totalnumber,maxperpage,filename)
    %>
  <tr>
    <td height="20" colspan="9" bgcolor="#D6DFF7">
    <%
dim b
if totalnumber mod maxperpage=0 then
b=totalnumber\maxperpage
else
b=totalnumber\maxperpage+1
end if
%>
<div align="center">共有<%=totalnumber%>/<%=maxperpage%>条,

当前页<%=currentpage%>/<%=b%> 
     <%
     dxystart=currentpage-5
     if dxystart<1 then dxystart=1
     dxyend=currentpage+5
     if dxyend>b then dxyend=b
     for dxy=dxystart to dxyend
     if dxy=currentpage then
     response.write "[<a href="http://www.popasp.com/&filename&"&page="&dxy&">"&"<font color=red>"&dxy&"</font>"&"</a>]"&" "
     else
     response.write "[<a href="http://www.popasp.com/&filename&"&page="&dxy&">"&dxy&"</font>"&"</a>]"&" "
     end if
     next
     %> 
    </div>    </td>
    </tr>
    <%
    end function
    %>
  </form>
</table>
<%
rs.close
set rs=nothing
conn.close
set conn=nothing
%>

11
22
33
隐藏区块

会员注册

本功能为预留功能,暂不支持注册 ^_^

Login

社交帐号登陆

使用以下任意帐号可登陆本站

Close section
Close

联系我们

关于5UCMS 您有任何需求 均可以留言给我们