标题:ASP初学者:困扰今天的代码看不懂/那个高手帮我解释下
取消只看楼主
kivenonly
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2009-11-10
 问题点数:0 回复次数:1 
ASP初学者:困扰今天的代码看不懂/那个高手帮我解释下
Sub View_Words()
         dim gbcount,y,j,k
         set rs = conn.execute("select COUNT(*) as gbcount From words")
         gbcount=rs("gbcount")
         rs.close
         
         if gbcount/n = int(gbcount/n) then '计算出分页数
         y=int(gbcount/n)
         else
         y=int(gbcount/n)+1
         end if

         page2= int(page/x)
         if page/x>page2 then page2=page2+1
         k=page2*x
         if k>y then k=y

         '打开留言字段'
         if page=1 then
         sql="select top "&n&" id,name,sex,head,web,email,title,words,date,reply,ip,come,view,qq From words Order By id Desc"
         else
         sql="select id,name,sex,head,web,email,title,words,date,reply,ip,come,view,qq From words Order By id Desc"
         end if
         if Page >100 then
            rs.Open sql,Conn,1
         else
            Set Rs=Conn.Execute(sql)
         end if
         if Page>1 then RS.Move n*page-n
        %>
<table width="700" border="0" cellspacing="1" cellpadding="4" align="center">
          <tr>
            <td width="667" height="20" align="right" class="unnamed1">有<%=gbcount %>条留言  <%=page %>/<%=y %>页 分页
                <a href="?page=1"><<</a>
                <% if page2>1 then %>
                <a href="<%=indexfilename%>?page=<%=page2*x-x%>"><</a>
                <% end if %>
                <% For m =page2*x-(x-1) To k %>
      [<a href="<%=indexfilename%>?page=<%=m%>"><%=m%></a>]
      <%
    Next
    %>
      <% if page2*x < y then %>
      <a href="<%=indexfilename%>?page=<%=m%>">></a>
      <% end if %>
      <a href="?page=<%=y %>">>></a>
            </td>
          </tr>
搜索更多相关主题的帖子: 代码 ASP 困扰 
2009-11-10 22:32
kivenonly
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2009-11-10
得分:0 
呵呵,谢谢各位大侠,就是自己对这个算法吸收不了
2009-11-17 17:35



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-291854-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.141099 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved