I am trying to hide / show a FCKeitor using the div style.display (none/inline). Using Firefox, when I redisplay a hidden editor I get a blank box with no toolbar and I am unable to type text. I was able to type text by setting the editor.EditorDocument.designMode = "on", but it doesn't include the original text and there are still no toolbars. Is there a better way to reset the editor?
Here is the code:
Here is the code:
<?php include("fckEditor/fckeditor.php"); function fck_textarea($areaId, $text){ $oFCKeditor = new FCKeditor($areaId) ; $oFCKeditor->BasePath = '/fckEditor/'; $oFCKeditor->Value = $text; $oFCKeditor->Create() ; } ?>
<html>
<head>
<Script language="javascript" type="text/javascript">
function reset_fckEditor(editorId){
var editor = FCKeditorAPI.GetInstance(editorId);
editor.EditorDocument.designMode = "on";
}
function showDiv(divId){
if(document.getElementById(divId).style.display=='none'){
document.getElementById(divId).style.display='inline';
reset_fckEditor('TestArea');
}
else{
document.getElementById(divId).style.display='none';
}
}
</script>
</head>
<body>
<form name="TestForm" action="temp.php" method = "POST">
<h2>Test Form That Doesn't Work</h2>
<a href="#" onclick="showDiv('TestDiv');return false;" style="position:relative">Show FCKEditor TextArea</a><hr/>
<div id="TestDiv" style="position:relative;display:none">
<?php fck_textarea("TestArea", "This is some sample text."); ?>
</div>
<hr/>
<h2>Test Form That Works</h2>
<?php fck_textarea("WorkingArea", "This is some sample text for the area that works."); ?>
<input type="submit" value="Submit">
</form>
</body>
</html>