我有一条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>.";
答案 0 :(得分: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>
答案 1 :(得分: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>.";
答案 2 :(得分: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>";
我希望这对你有用。