将JavaScript显示为文件中的可编辑代码

I am working to make html files of a website editable using CKEditor. I want the user should be able to edit the code of any html file via the admin panel. For this purpose I am using the file_get_contents function which seems to work fine except the JavaScript code is not displayed as editable code in the editor. I have tried the fread function as well and it also displays all the contents of the file in editor but I am still unable to get the JavaScript code in the editor as editable code. Any help?

Here's the code:

$contents = file_get_contents($_REQUEST['path']);
if(!$contents) die("Page not found");      
    $oFCKeditor = new FCKeditor('content') ;
    $oFCKeditor->BasePath = 'fckeditor/' ;
    $oFCKeditor->Width = '100%' ;
    $oFCKeditor->Height = '350' ; 
    if($mode == 'edit')$oFCKeditor->Value = stripslashes($contents);
    $oFCKeditor->Create() ; 

CKEditor (formerly FCKeditor) is a WYSIWYG(What-You-See-Is-What-You-Get) editor. WYSIWYG Editors take all the html,css & javascript, execute/parse it & try to display the output. so that's the reson Javascript code is not being shown in editor, as the editor is build to parse the javascript & display its output; instead of actual code.

Now, If you want to work directly with code, than its output. there are two options:

  1. Use the "View Source" button & you should be able to see all the javascript along with other code.There won't be any syntax highlighting but I this would work fine for small edits
  2. Use Source code editor: If you want proper syntax highlighting, you have to switch to a source code editor instead of WYSIWYG(What-You-See-Is-What-You-Get) editor. example of some source code editor