大拿帮忙啊!!!急死了!!!弄了好久!!!
请问用什么方法将以下数据库mysql的内容放到tinymce编辑器中:
下面我给大家讲讲javascript函数:
3f1c4e4b6b16bbbd69b2ee476dc4f83a <br>function show() <br>{ <br>alert("hello world"); <br>} <br>2cacc6d41bbb37262a98f745aa00fbf0
结果如图:
直接用PHP的select出来的,没有用!不能显示JS代码那一段,如图:
而我不用select出来的话直接用JS,代码如下:
<br /><script><br />window.onload=function()<br />{<br /> var text_id=document.getElementById("Article_Content"); //textarea的id<br /> var content='<P>下面我给大家讲讲javascript函数:</P><PRE class=js name="code"><script> <BR>function show() <BR>{ <BR>alert("hello world"); <BR>} <BR></script>
结果如图:
';
text_id.value=content;
//SetTinyMceContent("Article_Content",content);
}
却能够达到效果,如图:
我不知道是什么原因导致这种情况的,firebug出来的内容发现,主要是3f1c4e4b6b16bbbd69b2ee476dc4f83a 和<script>的区别,请问怎么解决这个问题????想了好久,就是不知道,,,,<br><font color='#FF8000'>------解决方案--------------------<br><pre class="brush: php">$new_content='<P>下面我给大家讲讲javascript函数:</P><PRE class=js name="code"><script> <BR>function show() <BR>{ <BR>alert("hello world"); <BR>} <BR></script></PRE> <P> 结果如图:<BR><IMG title=tu1 alt=tu1 src="uploaded/010P0000240111S5344-1.jpg" width=150 height=150 data-mce-src="uploaded/010P0000240111S5344-1.jpg">';<br />echo preg_replace_callback('/<\/?script>/i', function($r){return htmlentities($r[0]);}, $new_content) ;<br /><img src="/img/2014/04/18/103601113.png" alt="" /><br><font color='#FF8000'>------解决方案--------------------<br>你想要什么效果?<br /><br />把 html 代码放在 textarea 中时应做 html 实体转换:htmlentities<div class="clear">
</script>
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn