怎么样在页面上显示这个文字
怎样在页面上显示如下的文字:
<a href="http://localhost/CernetFLASHGame/CertificateShow.aspx?UserID=01000001008"><img src ="http://localhost/CernetFLASHGame/image/bt_18.gif" height=29 width=163 /></a>
而不是实际的内容.
多谢!
问题点数:20、回复次数:8Top
1 楼vivianfdlpw()回复于 2005-09-21 14:30:36 得分 3
用"\"转义:
string str="<a href=\"http://localhost/CernetFLASHGame/CertificateShow.aspx?UserID=01000001008\"><img src =\"http://localhost/CernetFLASHGame/image/bt_18.gif\" height=29 width=163 /></a>";
Response.Write(str);Top
2 楼Oceanson(洋之光)回复于 2005-09-21 14:31:42 得分 3
asp.net? 放在控件中textBox可以 textBox.text = "<a href="http://localhost/CernetFLASHGame/CertificateShow.aspx?UserID=01000001008"><img src ="http://localhost/CernetFLASHGame/image/bt_18.gif" height=29 width=163 /></a>";Top
3 楼linli2004(林立)回复于 2005-09-21 14:53:28 得分 2
比如< 你就用<替换,>用>替换
Top
4 楼ajieboy(齐)回复于 2005-09-21 15:04:29 得分 2
用Server.HtmlEncode编码一下再显示Top
5 楼mathsword(梦在流浪)回复于 2005-09-21 15:17:44 得分 7
当我们想在网页上显示HTML 标注时,若在网页中直接输出则会被浏览器解译为HTML 的内容,
所以要透过Server 对象的HtmlEncode 方法将它编码再输出;而若要将编码后的结果译码回原
本的内容,则使用HtmlDecode 方法。下列程序代码范例使用HtmlEncode 方法将「<B>HTML
内容</B>」编码后输出至浏览器,再利用HtmlDecode 方法将把编码后的结果译码还原:
<Html>
<Script Language="VB" Runat="Server">
Sub Page_Load(Sender As Object,e As Eventargs)
Dim strHtmlContent As String
strHtmlContent=Server.HtmlEncode("<B>HTML 内容</B>")
Response.Write(strHtmlContent)
Response.Write("<P>")
strHtmlContent=Server.HtmlDecode(strHtmlContent)
Response.Write(strHtmlContent)
End Sub
</Script>
</Html>Top
6 楼mathsword(梦在流浪)回复于 2005-09-21 15:18:29 得分 0
如果还搞不定,告诉我一声Top
7 楼9raul(ABC)回复于 2005-09-21 15:35:13 得分 0
用Server.HtmlEncode编码一下再显示Top
8 楼sunheartlee(心晴)回复于 2005-09-21 15:46:24 得分 3
<a href="http://localhost/CernetFLASHGame/CertificateShow.aspx?UserID=01000001008"><img src ="http://localhost/CernetFLASHGame/image/bt_18.gif" height=29 width=163 /></a>
OK!!
Top




