Danale's helping out! It took a long time!

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.