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

asp 過濾簡單html代碼程序

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

  Public Function HTMLEncode(fString)
  If Not IsNull(fString) Then
   fString = replace(fString ">" ">")
   fString = replace(fString "<" "&lt;")
   fString = Replace(fString CHR() " ") 
   fString = Replace(fString CHR() "&quot;")
   fString = Replace(fString CHR() "&#;")
   fString = Replace(fString CHR() "&nbsp;")
   fString = Replace(fString CHR() "")
   fString = Replace(fString CHR() & CHR() "<p></p> ")
   fString = Replace(fString CHR() "<br /> ")
   HTMLEncode = fString
  End If
 End Function
 
 ==============================
 函 數 名HTMLDncode
 作    用字符轉回函數
 參    數需要轉換的文本fString
 ==============================
 Public Function HTMLDncode(fString)
  If Not IsNull(fString) Then
   fString = Replace(fString "&gt;"">" )
   fString = Replace(fString "&lt;" "<")
   fString = Replace(fString " " CHR())
   fString = Replace(fString "&nbsp;" CHR())
   fString = Replace(fString "&quot;" CHR())
   fString = Replace(fString "&#;" CHR())
   fString = Replace(fString "" CHR())
   fString = Replace(fString "<p></p> "CHR() & CHR() )
   fString = Replace(fString "<br /> "CHR() )
   HTMLDncode = fString
  End If
 End Function


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