在用HttpUtility.HtmlDecode转义成html画面显示的时候遇到的奇怪问题
2012-03-29 15:18
344 查看
画面html代码显示
@{
DataTable dtReturn= (DataTable)ViewBag.DtReturnInfo;
}
@{
if (dtReturnInfo.Rows.Count > 0)
{
for (int i = 0; i < dtReturnInfo.Rows.Count; i++)
{
<div class="divContent">
<p style="margin-left:10px;" class="REPLY_CONTENT" title="@HttpUtility.HtmlDecode(dtReturn.Rows[i]["REPLY_CONTENT"].ToString())"></p>
</div>
}
}
}
javascript脚本
$(".divContent").each(function () {
$(this).find(".REPLY_CONTENT").html($(this).find(".REPLY_CONTENT").attr("title"));
})
给P标签赋值的时候必须用该标签的属性才可以把html代码在画面上正常显示。
@{
DataTable dtReturn= (DataTable)ViewBag.DtReturnInfo;
}
@{
if (dtReturnInfo.Rows.Count > 0)
{
for (int i = 0; i < dtReturnInfo.Rows.Count; i++)
{
<div class="divContent">
<p style="margin-left:10px;" class="REPLY_CONTENT" title="@HttpUtility.HtmlDecode(dtReturn.Rows[i]["REPLY_CONTENT"].ToString())"></p>
</div>
}
}
}
javascript脚本
$(".divContent").each(function () {
$(this).find(".REPLY_CONTENT").html($(this).find(".REPLY_CONTENT").attr("title"));
})
给P标签赋值的时候必须用该标签的属性才可以把html代码在画面上正常显示。
相关文章推荐
- ASIHTTPRequest包引入的时候遇到的问题libxml/HTMLparser.h file not found
- 关于SpringBoot创建时候遇到的问题之网页打开不显示信息
- [转-来自啊泰]推模式下dataset1下显示的是"...未找到项目..." 问题的解决[补充] [http://www.cnblogs.com/babyt/archive/2005/04/15/138588.html]
- [转-来自啊泰]推模式下dataset1下显示的是"...未找到项目..." 问题的解决 [http://www.cnblogs.com/babyt/archive/2005/04/15/138582.html]
- gdb时候遇到的奇怪问题(关于返回值)
- Chrome 下,重复使用 XMLHttpRequest进行Post数据时,遇到一个奇怪的问题
- HttpUtility.UrlEncode 在 Encode 的时候, 将空格转换成加号('+'), 在 Decode 的时候将加号转为空格, 但是浏览器是不能理解加号为空格的, 所以如果文件名包含了空格, 在浏览器下载得到的文件, 空格就变成了加号
- 使用Webview显示html文本遇到的字符实体问题
- 遍历List/Map的时候删除成员遇到的奇怪问题
- 将excel导入sqlserver时候遇到的奇怪问题
- 日期格式化的时候遇到的奇怪的问题
- 在做CRM界面的时候遇到的DIV滚动条自动显示的问题!!和解决方法!
- html_entity_decode 函数 编辑器输出之显示含html为转义 thinkphp
- 学习中遇到的问题--json显示带小数点数字时被转义
- html代码转义到js时,往往会遇到问题,这代码实现html和js互转
- 本地运行FlashPlayer访问本地文件的设置 / 本地运行flash不能正常显示问题(转http://hi.baidu.com/slzs_zyt/blog/item/c8a40697aa45ac6354fb9630.html)
- PHP 5.4 中经 htmlspecialchars 转义后的中文字符串为空,DeDeCMS在PHP5.4下编辑器中文不显示问题
- html转义无法显示问题
- 解决StoryBoard上cell上定义的view的背景点击后不显示的问题(其中用uiview 当作线的时候最多遇到,会不显示线 而出现不流畅问题)
- HttpServerUtility Server.HtmlEncode与Server.HtmlDecode