Thanks for this Gary. However when I tried it, I got an "htmlEd.field' is null or not an object" error. But it worked if I used:
htmlEd = document.getElementByID('EXTFLDV_500239_HTML_EDITOR');
and then
htmlEd.attachEvent('eLoadComplete', customHTMLEdDisplay);
The next thing was to apply this to all fields of the class "RichText". As you suggested, I tried using jquery but couldn't get it working (probably due to my inexperience with jquery and coding in general). But I got close with the following:
=======
// This function allows the creation of an array based on class name. Taken from http://javascript.about.com/library/bldom08.htm
document.getElementsByClassName = function(cl) {
var retnode = [];
var myclass = new RegExp('\\b'+cl+'\\b');
var elem = this.getElementsByTagName('*');
for (var i = 0; i < elem.length; i++)
{
var classes = elem[i].className;
if (myclass.test(classes)) retnode.push(elem[i]);
}
return retnode;
};
function registerHandler()
{
var richTextArray = document.getElementsByClassName('RichText');
var l = richTextArray.length;
for (var i=0;i<l;i++)
{
richTextArray[i].attachEvent('eLoadComplete', customHTMLEdDisplay);
}
}
function customHTMLEdDisplay()
{
if (window.event) window.event.srcElement.DisplayOptions = 14;
}
=========
But 'window.event' is null when this is run. If I change the attached event to something like 'onmouseover', it then works as expected. So is there something about how the eLoadComplete event is fired?