Danale !!! In a hurry !!! It took a long time !!! How can I put the following mysql database content in the tinymce editor: & lt; P & gt; below I will tell you about javascript functions: & lt; P & gt; & lt; PRE & nbsp; code & gt; & amp; lt; script & amp; gt; & nbsp; & lt; BR & gt; fu Danale help !!! In a hurry !!! It took a long time !!!
How can I put the following mysql database content in the tinymce editor:
The following describes javascript functions:
<script>
function show()
{
alert("hello world");
}
</script>
Result
It is useless to directly use the PHP select statement! The section of JS code cannot be displayed,
I directly use JS without using the select statement. The code is as follows:
Script
Window. onload = function ()
{
Var text_id = document. getElementById ("Article_Content"); // id of textarea
Var content ='The following describes javascript functions:
<script>
function show()
{
alert("hello world");
}
</script>
Result
';
Text_id.value = content;
// SetTinyMceContent ("Article_Content", content );
}
Script
But can achieve the effect,
I don't know why this problem occurs. the content of firebug found mainly the difference between <script> and "script". how can I solve this problem ???? After thinking for a long time, I just don't know ,,,,
------ Solution --------------------
$ New_content ='The following describes javascript functions:
《script》
function show()
{
alert("hello world");
}
《script》
Result
';
Echo preg_replace_callback ('/<\/? Script>/I ', function ($ r) {return htmlentities ($ r [0]) ;}, $ new_content );
------ Solution --------------------
What effect do you want?
Html entity conversion should be performed when html code is put in textarea: htmlentities