【问题标题】:Escape apostrophe in aspx file在 aspx 文件中转义撇号
【发布时间】:2010-04-15 19:27:49
【问题描述】:

如何在 ASP.net XML 中转义撇号/单引号?

<asp:Button ID="myButton" runat="server"
    OnClientClick='confirm("How do you escape this apos'trophe?")' />

【问题讨论】:

    标签: asp.net javascript xml escaping


    【解决方案1】:
    <asp:Button ID="btnClone" runat="server" OnClick="btnClone_Click"
        OnClientClick="confirm('How do you escape this apos\'trophe?')" />

    【讨论】:

      【解决方案2】:
      <asp:Button ID="myButton" runat="server"
          OnClientClick='confirm("How do you escape this apos&#39;trophe?")' />
      

      【讨论】:

      • 这不起作用,因为确认框不评估 html 代码。还是这样?
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-13
      • 2011-01-25
      • 2022-11-15
      • 2012-03-24
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多