日期:2014-05-17  浏览次数:20837 次

如何在页面上用 response.write 的方法输出:<table width=100%> 这几个字符呀。我总是不能实现
如何在页面上用   response.write   的方法输出: <table   width=100%>   这几个字符呀。我总是不能实现
----------------
我如果这样写:(用到转义符\)
response.write   "table   width=100%\> "
则用ie浏览的结果为:
table   width=100%>
也就是说左尖号   <   无法输出,
我如果这样写:(即加上左尖号)
response.write   " <table   width=100%\> "
则没有输出结果

我知道 <和> 都是特别的符号,但是如果网页中就要显示这样的字符时,应该如何做呢?


------解决方案--------------------
response.write Server.HTMLEncode( " <table width=100%\> ")

------解决方案--------------------
response.write "&lt;table width=100%&gt; "

------解决方案--------------------
<table width=100%>

这个是html代码,所以会被浏览器解释。因为代码不是一个完整的表格,所以在页面上可能看不到。查看网页源代码应该能看到你输出的东西。

如果要作为字符显示在页面上,

hui_hui_2007(好心情)的答案就可以。response.write "&lt;table width=100%&gt; "

------解决方案--------------------
楼主的问题原因在于存在了%> ,解析的时候把它当成一段代码的结束
加上属性的引号,或者把width通过style属性来设定来避免%和> 连起来.