从数据库取出的用富文本编辑器编辑过的图文消息,直接显示在网页上怎么原样输出呢?
数据能从数据库拿出来,像标题之类的字段动能显示,唯独富文本编辑过的内容显示不出来;请大神们帮忙解决!!!!
<script type="text/javascript">
$(document).ready(function(){
$.ajax({
type:'post',
url:'getNewsByNewId.html',
dataType:'json',
success:function(data){
alert(data);
//alert($('#newsTitle').val(data.theme););
//alert(data.theme);
alert(data.content);
//alert(data.author);
$('#newsTitle').val(data.theme);
$('#newsAuthor').val(data.author);
$('#checker').val(data.checker);
$('#editor').val(data.content);
//UE.getEditor('editor').setContent(data.content);
}
});
});
</script>
上面是我从后台拿数据的代码;
<body>
<form action="newsAdd.html" id="editor_id" name="newsadd" method="post">
<div id="login">
<a class="login_txt_bt" ><h1>新闻消息录入</h1></a>
</div>
<br/>
<div>
新闻标题: <input type="text" id=newsTitle name="newsTitle" style="width:220px;height:15px;" tabindex="1"></input>
</div>
<br/>
<div>
新闻作者: <input type="text" id=newsAuthor name="newsAuthor" style="width:150px;height:15px;" tabindex="2"></input>
</div>
<br/>
<div>
审核人为: <input type="text" id=checker name="checker" style="width:150px;height:15px;" tabindex="2"></input>
</div>
<br/>
<div>
新闻栏目: <select id="section" name="section" style="width:105px;height:20px;"tabindex="3"></select>
</div>
<br/>
<div>
<script id="editor" name="content" type="text/plain" style="width:1000px;height:200px;"></script>
</div>
<div>
<button onclick="getAllHtml()">获得整个html的内容</button>
<button onclick="getContent()">获得内容</button>
<button onclick="setContent()">写入内容</button>
</div>
<br/>
<input type="submit" id="button" name="button" value="提交" tabindex="6" />
</form>
<script type="text/javascript">
//实例化编辑器
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
var ue = UE.getEditor('editor');
function getAllHtml() {
alert(UE.getEditor('editor').getAllHtml())
}
function getContent() {
var arr = [];
arr.push("使用editor.getContent()方法可以获得编辑器的内容");
arr.push("内容为:");
arr.push(UE.getEditor('editor').getContent());
alert(arr.join("\n"));
}
</script>
</body>
这是加载编辑器的代码