ASP內容分頁函數

來源:互聯網
上載者:User
  1. <%   
  2. '==============================================   
  3. '函數名:contentpage   
  4. '作  用:內容分頁   
  5. '參  數:1、ocontent ----- 文章內容   
  6. '   2、olink  ----- 連結   
  7. '整  理:www.asp教程program.cn   
  8. '原創文章,轉載請保留此資訊,謝謝   
  9. '==============================================   
  10.   
  11. function contentpage(ocontent, olink)   
  12.     dim outstr, arrcontent, nextpage, arrpage   
  13.     if instr(ocontent, "[nextpage]") <= 0 then  
  14.         outstr = ocontent   
  15.     else  
  16.         nextpage = request("nextpage")   
  17.         arrcontent = split(ocontent, "[nextpage]")   
  18.         arrpage = ubound(arrcontent) + 1   
  19.         if (nextpage = "" or isnull(nextpage) or not isnumeric(nextpage)) then  
  20.             nextpage = 1   
  21.         else  
  22.             nextpage = cint(nextpage)   
  23.         end if  
  24.         if nextpage < 1 then  
  25.             nextpage = 1   
  26.         end if  
  27.         if nextpage > arrpage then  
  28.             nextpage = arrpage   
  29.         end if  
  30.         outstr = arrcontent(nextpage - 1)   
  31.         outstr = outstr "<br>"  
  32.         for iii = 1 to arrpage   
  33.             if iii = nextpage then  
  34.                 outstr = outstr "<font color=""red"">"&iii"</font> "  
  35.             else  
  36.                 outstr = outstr "<a href="""&olink"nextpage="&iii""">"&iii"</a> "  
  37.             end if  
  38.         next  
  39.     end if  
  40.     contentpage = outstr   
  41. end function  
  42.   
  43. '=================demo==================   
  44. dim sstrhtml, ostrhtml   
  45. sstrhtml = "我的名字叫胡浪[nextpage]胡是古月的胡[nextpage]浪是三點水一個良字的浪[nextpage]不是一個帥哥哦[nextpage]很普通的一個人"  
  46. ostrhtml = "我的名字叫胡浪,胡是古月的胡,浪是三點水一個良字的浪,不是一個帥哥哦,很普通的一個人"  
  47. '=================demo==================   
  48. response.write("------------------- 帶分頁 ---------------------")   
  49. response.write("<br>")   
  50. response.write(contentpage(sstrhtml, "?"))   
  51. response.write("<br>")   
  52. response.write("------------------- 不帶分頁 ---------------------")   
  53. response.write("<br>")   
  54. response.write(contentpage(ostrhtml, "?"))   
  55. %>  
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.