If you ve been trying to use the setAttribute function to dynamically change the properties of an HTML element and wondering what to do when it fails on Internet Explorer 6 then here s something that most definitely works:

var oDiv =  document.getElementById(“div_name”);

Instead of typing
oDiv.setAttribute(“style”, “color:#666;”);
Simply access that property directly by Javascript
oDiv.style.cssText = “background-color:#666″;

This works on ie6 ie7 and ff. I havent checked in Netscape.
I found this solution here

http://www.quirksmode.org/bugreports/archives/2005/03/setAttribute_does_not_work_in_IE_when_used_with_th.html

It is the 5th comment on the page by Rob.(http://blog.throbs.net/)

Rich Text Editor for CMS

January 27, 2007

I ve decided I m going to create one CMS system and use it for every project. Same with the shopping cart and the products section of any site. There is a bit of a mental debate regarding MySQL and XML but one of them should be soon finalized. The sole reason for considering XML is ‘it is portable’ and I still need to learn how to transfer a MySQL database from one server to another.

The objective of creating one CMS or shopping cart system is, once that is done then I can concentrate solely on design which is something that has not been done consciously for years now.

Anyway, any good CMS solution should have at least some basic text formatting options when users add content. The solution that I had provided earlier was: Above every ‘textarea’ where the user would insert content, I had written very proudly ‘Feel free to use HTML tags in here!’ Now that was some solution!

I have noticed that useless solutions dont make a big issue, they simply get ignored and die out on their own. So I started hunting for tutorials to make rich text editors for CMS. Fortunately, I came across the following link: http://www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm. It gave me just what I wanted: A text editor that generates code for whatever formating the user does inside the textarea.

Though I still havent checked if the same code gets converted into formatted textarea while editing it!