• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
    • 軟件測試技術
    • 軟件測試博客
    • 軟件測試視頻
    • 開源軟件測試技術
    • 軟件測試論壇
    • 軟件測試沙龍
    • 軟件測試資料下載
    • 軟件測試雜志
    • 軟件測試人才招聘
      暫時沒有公告

    字號: | 推薦給好友 上一篇 | 下一篇

    超長字符的智能分頁-支持HTML

    發布: 2007-7-14 19:37 | 作者: 佚名    | 來源: 網絡轉載     | 查看: 9次 | 進入軟件測試論壇討論

    領測軟件測試網 大概在九九年做游戲網站的時候,就對文章的發布感到麻煩,不過那會兒玩ASP不精。只是將就用著。在遇到長文件 10000 字時網頁就是一大片長了。

    去年,做一個通用的文章與新聞管理系統時,曾寫了一段代碼,用來分離,F在貼出來。

    要說明的是:

    我的文章 錄入界面是基于WEB的HEMLEDITOR,就像這里的ABC代碼差不多。所以實際提交的是HTML格式的文 本。

    對HTML做了相應的處理,不會由HTML代碼中切開。

    這里另一位兄弟曾發表過一個,原理一樣,不過我沒仔細看過,不知有啥不同。


    代碼如下:
    --------------------------------------
    'Request Form Item
    I_Forder = Request.Form ("I_Folder")
    I_Topic = Request.Form ("I_Topic")
    I_Title = htmlencode(Request.Form ("I_Title"))
    I_Body = Request.Form ("body")
    I_Source = Request.Form ("I_Source")
    I_Keyword= htmlencode(Request.Form ("I_Keyword"))
    I_ISHOT = request.form("ishot")
    if i_ishot = "" then i_ishot="N"
    i_ispic = request.form("ispic")
    if i_ispic = "" then i_ispic ="N"
    i_pic = request.form("InsertImage")
    i_body = replace(i_body,"contentEditable=true","contentEditable=false")

    'Check Input
    '......

    'Get Pages ,B = Body
    B_Len = Len(I_Body)
    B_Pages = 1
    'T = Temp
    T_Loop = true

    Do While T_Loop '這里loop多次,每4000分一頁,算出頁碼并加入庫。
    If B_Len > 4000 then
    N_Body = Left(I_Body,4000) 'N = New
    'If "<P" in N_Body,Else ">" in N_Body
    If Instrrev(N_Body,"<P") > 0 and (Len(N_Body) - Instrrev(N_Body,"<P"))< 400 then
    N_Body = Left(N_Body,InstrRev(N_Body,"<P")-1)
    else if Instrrev(N_Body,"  ") > 0 and (Len(N_Body) - Instrrev(N_Body,"  "))< 400 then
    N_Body = Left(N_Body,InstrRev(N_Body,"  ")-1)
    Else If Instrrev(N_Body,"。") > 0 and (Len(N_Body) - Instrrev(N_Body,"。"))< 400 then
    N_Body = Left(N_Body,InstrRev(N_Body,"。"))
    Else If Instrrev(N_Body,";") > 0 and (Len(N_Body) - Instrrev(N_Body,";"))< 400 then
    N_Body = Left(N_Body,InstrRev(N_Body,";"))
    else if Instrrev(N_Body,",") > 0 and (Len(N_Body) - Instrrev(N_Body,","))< 400 then
    N_Body = Left(N_Body,InstrRev(N_Body,","))
    else if Instrrev(N_Body,".") > 0 and (Len(N_Body) - Instrrev(N_Body,"."))< 400 then
    N_Body = Left(N_Body,InstrRev(N_Body,"."))
    end if
    end if
    End If
    End If
    end if
    End if

    N_Len = Len(N_Body)
    I_Body = Mid(I_Body,N_Len+1)
    B_Len = Len(I_Body)

    Else
    N_Body = I_Body
    T_Loop = false
    End If


    'Add to database
    Exec_prc_Content_Ins I_Forder,I_Topic,I_Title,I_Source,N_Body,i_ispic,i_pic,i_ishot,I_Keyword,B_Pages

    '這里一個function,你可以自己處理,反正結果有兩個,一個是body,一個是b_pages,就是頁碼。


    B_Pages = B_Pages + 1

    Loop


    %>

    <html>

    <head>
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>新建網頁 1</title>
    <link rel="stylesheet" type="text/css" href="../CSS/default.css">
    </head>

    <body>

    <div align="center">
    <center>

    <table border=1 width="300" height="128" bordercolor="#000000" cellspacing="0" cellpadding="0" style="border-collapse: collapse"><tr>
    <td bgcolor="#DEDBD6" height="31">
    錄入成功</td></tr><tr><td height="96">
    <p align="center">此文章共分<%=B_Pages-1%>頁
    </td></tr></table>


    </center>
    </div>
    <script>
    top.main_top.location.reload();
    </script>

    </body>


    延伸閱讀

    文章來源于領測軟件測試網 http://www.kjueaiud.com/


    關于領測軟件測試網 | 領測軟件測試網合作伙伴 | 廣告服務 | 投稿指南 | 聯系我們 | 網站地圖 | 友情鏈接
    版權所有(C) 2003-2010 TestAge(領測軟件測試網)|領測國際科技(北京)有限公司|軟件測試工程師培訓網 All Rights Reserved
    北京市海淀區中關村南大街9號北京理工科技大廈1402室 京ICP備10010545號-5
    技術支持和業務聯系:info@testage.com.cn 電話:010-51297073

    軟件測試 | 領測國際ISTQBISTQB官網TMMiTMMi認證國際軟件測試工程師認證領測軟件測試網

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>