Another way you could test to see if you're in edit mode it to test to see if
the Body field exists. This keeps all the code in one place. For example:
function initEditor() {
if(!document.forms || !document.forms[0].Body)
return; // Not in edit mode
var editor = new HTMLArea("Body");
editor.generate();
}
In fact, in the interest of generality and reuse, I'd modify this funciton to
work with any field name like this:
function initEditor(fieldName) {
if(!document.forms || !document.forms[0][fieldName])
return; // Not in edit mode
var editor = new HTMLArea(fieldName);
editor.generate();
}
Another way you could test to see if you're in edit mode it to test to see if the Body field exists. This keeps all the code in one place. For example:
function initEditor() { if(!document.forms || !document.forms[0].Body) return; // Not in edit mode var editor = new HTMLArea("Body"); editor.generate(); }
In fact, in the interest of generality and reuse, I'd modify this funciton to work with any field name like this:
function initEditor(fieldName) { if(!document.forms || !document.forms[0][fieldName]) return; // Not in edit mode var editor = new HTMLArea(fieldName); editor.generate(); }
Best regards,
Rob:-]