熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

asp html轉成html編碼程序

2022-06-13   來源: .NET編程 

  function htmlencode(str)
    dim result
    dim l
    if isNULL(str) then
       htmlencode=""
       exit function
    End if
    l=len(str)
    result=""
 dim i
 for i = to l
     select case mid(stri)
            case "<"
                 result=result+"&lt;"
            case ">"
                 result=result+"&gt;"
            case chr()
                 result=result+"&quot;"
            case "&"
                 result=result+"&amp;"
              case chr()           
                 result=result+"&nbsp;"
                 if i+<=l and i> then
                    if mid(stri+)=chr() or mid(stri+)=chr() or mid(stri)=chr() or mid(stri)=chr()  then                      
                       result=result+"&nbsp;"
                    else
                       result=result+" "
                    End if
                 else
                    result=result+"&nbsp;"                    
                 End if
            case chr()
                 result=result+"    "
            case else
                 result=result+mid(stri)
         End select
       next
       htmlencode=result
   End function
}


From:http://tw.wingwit.com/Article/program/net/201311/14021.html
    推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.