如何在文本区域中设置值

I'm working on the playground using from codemirror.net, and is works great. My next step is to have auto load set a value to file path name, each textarea will load file path from .html, .css and jquery.

currently in codemirror showing

<div id="wrap">

  <!-- Code Editors -->   <section id="code_editors">
    <div id="html" class="code_box">
      <h3>HTML</h3>
      <textarea name="html"></textarea>
    </div>
    <div id="css" class="code_box">
      <h3>CSS</h3>
      <textarea name="css"></textarea>
    </div>
    <div id="js" class="code_box">
      <h3>JavaScript</h3>
      <textarea name="js"></textarea>
    </div>   </section>
     <!-- Sandboxing -->   <section id="output">
    <iframe></iframe>   </section>    </div>

The result of preview textarea showed "Hello world" that because in javascript showed

  html_editor.setValue('<p>Hello World</p>');
    css_editor.setValue('body { color: red; }');

so i change set value in codemirror like this.

    <textarea name="html"><?php
echo file_get_contents('testcode.php');
?>
</textarea>
</div>

this works great when I see HTML code inside of text area but unable to see the preview in the text area.

so I'm trying to solve this how to see preview too using

<?php echo file_get_contents('testcode.php');?>

I thought to make change in javascript where it said

html_editor.setValue('<p>Hello World</p>');
    css_editor.setValue('body { color: red; }');

my question is that how can I write code in PHP inside of javascript file.

i tried

html_editor.setValue('<?php echo file_get_contents('testcode.php');?>');
    css_editor.setValue('body { color: red; }');

it does not work.

Any other idea how to solve this to make both works!

many thanks.

AM

Try this :

var = "<?php echo file_get_contents('testcode.php')?>";
html_editor.setValue(var );
css_editor.setValue('body { color: red; }');