当前位置:网站首页 > 网站建设教程 > HTML教程 > 正文

过滤字符串中的HTML代码(VBScript)

教程管理员 发布于2023-10-02 14:08 HTML教程 167

简介: Public Function FilterHTML(str)     If Trim(str)=" " or IsNull(str) then         FilterHTML=" "     Else         str=Replace(str,">",">";     ...

Public Function FilterHTML(str)

    If Trim(str)=" " or IsNull(str) then

        FilterHTML=" "

    Else

        str=Replace(str,">",">";

        str=Replace(str,"<","&lt;";   

        str=Replace(str,char(32)"&absp;"; 

        str=Replace(str,char(9),"&nbsp;"; 

        str=Replace(str,char(34),"&quot;"; 

        str=Replace(str,char(39),"&#39;"; 

        str=Replace(str,char(13),""; 

        str=Replace(str,char(10)&char(10),"</p></p>")

        str=Replace(str,char(10),"<br>")  

        FilterHTML=str

    End If

End Function


琼ICP备09004296号-12