zoukankan      html  css  js  c++  java
  • ASP HTMLEncode/HTMLDecode

    asp 有Server.HTMLEncode 却没有 Server.HTMLDecode.......

    需要自定义一个 HTMLDecode 函数:

    Function HTMLDecode(sText)
    	dim I
    	sText = Replace(sText, """, Chr(34))
    	sText = Replace(sText, "<", Chr(60))
    	sText = Replace(sText, ">", Chr(62))
    	sText = Replace(sText, "&" , Chr(38))
    	sText = Replace(sText, " ", Chr(32))
    	For I = 1 to 255
    	sText = Replace(sText, "&#" & I & ";", Chr(I))
    	Next
    	HTMLDecode = sText
    End  Function
    

      

    例子:

    <%
    
    Dim j
    Response.Write(Server.HTMLEncode("encode: 555  <p>hhhh</p>jj ffff  888 ") & "<br>-----------------------------<br>")
    Response.Write(HTMLDecode("decod: 555 <p>hhhh</p>jj ffff  888 "))
    Function HTMLDecode(sText)
    	dim I
    	sText = Replace(sText, """, Chr(34))
    	sText = Replace(sText, "<", Chr(60))
    	sText = Replace(sText, ">", Chr(62))
    	sText = Replace(sText, "&" , Chr(38))
    	sText = Replace(sText, " ", Chr(32))
    	For I = 1 to 255
    	sText = Replace(sText, "&#" & I & ";", Chr(I))
    	Next
    	HTMLDecode = sText
    End  Function
    %>
    

      

  • 相关阅读:
    mybatis的知识点总结
    orm框架与缓存的关系
    mybatis知识点
    mybatis
    MyBatis的动态SQL详解
    工资谈判技巧
    MySQL 创建函数(Function)
    开始AFNetworking
    hdu 4778 Rabbit Kingdom(减少国家)
    设计模式:代理模式
  • 原文地址:https://www.cnblogs.com/wgscd/p/10488490.html
Copyright © 2011-2022 走看看