0
Dim hyp = New HyperLink()
hyp.ID = a_taglist(itags)
hyp.Attributes.Add("onmousedown", "return clk('" & a_taglist(itags) & "')")
panel1.Controls.Add(hyp)

I want the row:

hyp.Attributes.Add("onmousedown", "return clk('" & a_taglist(itags) & "')")

To add a onmousedown attribute to the hyperlink.

It kind of works but it gets replaced with & # 39;

 onmousedown="return clk(& #39;bavaria& #39;)"

How can I avoid this. I've tried to "\" escape it out and sending it char(&#39) already.

Any ideas?

4

1 回答 1

0

这只是.NET 4.0 中(显然)引入的一项安全功能。重点是防止 XSS 攻击,但在实践中,这对您来说应该不是问题。

例如,请参阅此 jsfiddle

<input type="button" value="Click Me" onclick="alert(&#39;Hello&#39;);" />
于 2013-04-30T16:27:59.140 回答