I have a page with multiple editors, where I've created a button, which allows the user to switch between different contents in these editors.
The script which changes the content in the editors uses the SetHTML function in the API.
However: When the script is called the first time, nothing happens. Following calls to the function triggers an error "Function SetHTML does not exist" in Firefox.
Does anyone know, whats happening?
Below is part of the page in question:
<head><script type="text/javascript" src="/FCKeditor/fckeditor.js"></script></head>
<body>
<textarea name="status" id="status">Some HTML-code</textarea>
<textarea name="detaljer" id="detaljer">Some other HTML-code</textarea>
<textarea name="fokus" id="fokus">Some HTML</textarea>
<textarea name="andet" id="andet"></textarea>
<button type="button" onclick="genbrug(0)">Change contents</button>
<script type="text/javascript">
<!--
var area = document.getElementsByTagName('textarea');
for (x=0;x<area.length;x++) {
setTimeout("createEditor('" + area[x].id + "')",1000*x);
}
function createEditor(id) {
var editor = new FCKeditor(id);
editor.ToolbarSet = "Basic";
editor.BasePath = "/FCKeditor/";
editor.ReplaceTextarea();
}
function genbrug(x) {
// This function switches between editorcontents
var editor = new Array();
editor[0] = FCKeditorAPI.GetInstance('status');
editor[1] = FCKeditorAPI.GetInstance('fokus');
editor[2] = FCKeditorAPI.GetInstance('detaljer');
editor[3] = FCKeditorAPI.GetInstance('andet');
// Delete alle text in the editors
for (navn=0;navn<editor.length;navn++) {
editor[navn].SetHTML('');
}
if (x==0) {
// First case
knap.onclick = function() {genbrug(1);}
editor[0].SetHTML = 'A different HTML for the editor';
editor[1].SetHTML = 'Another HTML for a different editor';
} else {
// Så skal vi indsætte DIANA's forslag
knap.firstChild.nodeValue = "Genbrug tidligere elevplan";
knap.onclick = function() {genbrug(0);}
editor[0].SetHTML('Some HTML-code');
editor[1].SetHTML('Some different HTML');
editor[3].SetHTML('');
}
}
-->
</script>
</body>
Thanks in advance
The script which changes the content in the editors uses the SetHTML function in the API.
However: When the script is called the first time, nothing happens. Following calls to the function triggers an error "Function SetHTML does not exist" in Firefox.
Does anyone know, whats happening?
Below is part of the page in question:
<head><script type="text/javascript" src="/FCKeditor/fckeditor.js"></script></head>
<body>
<textarea name="status" id="status">Some HTML-code</textarea>
<textarea name="detaljer" id="detaljer">Some other HTML-code</textarea>
<textarea name="fokus" id="fokus">Some HTML</textarea>
<textarea name="andet" id="andet"></textarea>
<button type="button" onclick="genbrug(0)">Change contents</button>
<script type="text/javascript">
<!--
var area = document.getElementsByTagName('textarea');
for (x=0;x<area.length;x++) {
setTimeout("createEditor('" + area[x].id + "')",1000*x);
}
function createEditor(id) {
var editor = new FCKeditor(id);
editor.ToolbarSet = "Basic";
editor.BasePath = "/FCKeditor/";
editor.ReplaceTextarea();
}
function genbrug(x) {
// This function switches between editorcontents
var editor = new Array();
editor[0] = FCKeditorAPI.GetInstance('status');
editor[1] = FCKeditorAPI.GetInstance('fokus');
editor[2] = FCKeditorAPI.GetInstance('detaljer');
editor[3] = FCKeditorAPI.GetInstance('andet');
// Delete alle text in the editors
for (navn=0;navn<editor.length;navn++) {
editor[navn].SetHTML('');
}
if (x==0) {
// First case
knap.onclick = function() {genbrug(1);}
editor[0].SetHTML = 'A different HTML for the editor';
editor[1].SetHTML = 'Another HTML for a different editor';
} else {
// Så skal vi indsætte DIANA's forslag
knap.firstChild.nodeValue = "Genbrug tidligere elevplan";
knap.onclick = function() {genbrug(0);}
editor[0].SetHTML('Some HTML-code');
editor[1].SetHTML('Some different HTML');
editor[3].SetHTML('');
}
}
-->
</script>
</body>
Thanks in advance
RE: SetHTML
There was improper use of SetHTML in the first case of the function...
Sorry for bothering you...