ASP HTMLEncode 方法


HTMLEncode 方法对一段指定的字符串应用 HTML 编码。

语法

  1. Server.HTMLEncode(string)

参数 描述
string 必需。要编码的字符串。

实例

  1. 脚本:

    <%
    response.write(Server.HTMLEncode("The image tag: <img>"))
    %>

    输出:

    The image tag: &lt;img&gt;

    Web 浏览器输出:

    The image tag: <img>