Chinapromoter Blog

生活, 艺术, 网络, 技术, 工业, 消费, 记录趣味生活的点点滴滴。

« ASP网页采用UTF-8编码解决乱码问题著名NLP培训大师、情绪智能专家李中莹教你处理孩子情绪 »

老程序SXWO简单版分页出现负数

老程序SXWO简单版, 在分页超过9页时, 页数出现负数, 如 -3 -2 -1 0 1 2 3 , 把CREATEPAGECOMMON.ASP 的(totalrecord,12) 修改为 (totalrecord,30), 错误休正。

function getindex(spageid)
  dim spagenum,startpage,i
  spagenum=15 '15
  startpage=0
  set p_rs=server.createobject("adodb.recordset")
  p_sql="select id from down"
  p_rs.open p_sql,conn,1,1
  totalrecord=p_rs.recordcount
  totalpage=chu(totalrecord,30) 'totalpage=chu(totalrecord,12)ԭ
  getindex="<b>Page "&spageid+1&" of "&totalpage&"</b>&nbsp;&nbsp;&nbsp;&nbsp;"
  if spageid-int(spagenum/2)<=0 then
            startpage=0
  else
     if totalpage-spageid>int(spagenum/2) then
            startpage=spageid-int(spagenum/2)
     else
            startpage=totalpage-spagenum
     end if
  end if
  if startpage>0 then
     getindex=getindex&"<a href=index"&spageid-1&".htm>Previous</a> "
  end if
  for q=startpage to totalpage-1
      q1=q
      if q1=0 then q1=""
      i=i+1
      if q=spageid then
         getindex=getindex&"<b>"&q+1&"</b>&nbsp;"
      else
         getindex=getindex&"<a href=index"&q1&".htm><u>"&q+1&"</u></a>&nbsp;"
      end if
      if i>=spagenum then exit for
  next
  if q<totalpage-1 then
      getindex=getindex&"<a href=index"&spageid+1&".htm>Next</a> "
  end if
  p_rs.close
  set p_rs=nothing
end function

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新评论及回复

最近发表


Powered By Z-Blog 1.8 Spirit Build 80605

Copyright www.chinapromoter.cn. Some Rights Reserved. 浙ICP备05022498号