0

我有一个要添加链接的 html 响应消息。是否可以添加以下链接:

responseMsg.InnerText = "Your postcode is in the network, so please proceed to Step 2.";

我尝试了以下方法,但它导致用户控件崩溃:

responseMsg.InnerText = "Your postcode is in the network, so please <a href="#">proceed to Step 2</a>.";
4

3 回答 3

2

尝试设置InnerHtml

responseMsg.InnerHtml = "Your postcode is in the network, so please <a href='#'>proceed to Step 2</a>.";

使用可以转义锚标记中的双引号,例如<a href=\"#\">...</a>

或者您可以使用单引号,例如<a href='#'>...</a>

于 2012-06-28T02:22:59.927 回答
0

更改单引号的双引号

responseMsg.InnerText = "Your postcode is in the network, so please "<a href='http://proceedtosteptwo.aspx' title='this is a test'>proceed to Step 2</a>";

我希望这对你有用。

于 2012-06-28T02:15:41.527 回答
0

你可以做任何一种方式

转义引号

responseMsg.InnerText = "Your postcode is in the network, so please <a href=\"#\">proceed to Step 2</a>.";

或在 href 上使用单引号

responseMsg.InnerText = "Your postcode is in the network, so please <a href='#'>proceed to Step 2</a>.";
于 2012-06-28T02:04:57.207 回答