views:

137

answers:

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

Would this work? (I will try in a minute)

<asp:Button ID="myButton" runat="server"
    OnClientClick="confirm(""How do you escape this apos'trophe?"")" />
Joe Philllips
Nope, doesn't work.
Joe Philllips
+2  A: 
<asp:Button ID="btnClone" runat="server" OnClick="btnClone_Click"
    OnClientClick="confirm('How do you escape this apos\'trophe?')" />
Claudio Redi
A: 
<asp:Button ID="myButton" runat="server"
    OnClientClick='confirm("How do you escape this apos&#39;trophe?")' />
AaronS
That doesn't work because the confirmation box doesn't evaluate the html codes. Or does it?
Joe Philllips
I tried this, and it does work.
AaronS
Maybe it only works with ' but not '
Joe Philllips
' works for me. Did you try it?
AaronS