View Full Version : Javascript RT Editor

01-31-2007, 11:44 AM
hi i am using a rich text editor for my site

i got rt editor from


this site

But there is a problem in this for all browsers, when i am selecting a font from the font section.The font section is not showing which fond i choosed.it showing font only.( ie if i am selecting a Times new Roman i want to show up that fond name in that column,but here its just showing font)The same thing happening for all other controls in the rt editor.Can anyone suggest me a good editor or what is the problem i am facing in the current rt editor.i am not good in javascript.please give me a suggestion and an idea regarding with this.

Have a nice day

01-31-2007, 12:25 PM
I've modified the source code in richtext.js which comes as a part of the RT Editor bundle. So if you've included richtext_compressed.js in your web pages then you have to remove that inclusion and have to include richtext.js

Please replace your richtext.js with the attached richtext.js (I've modified this file).

Modification Made
This was very simple

1. I've made the modification in the following function which is present in richtext.js

function selectFont(rte, selectname) {
//function to handle font changes
var idx = document.getElementById(selectname).selectedIndex;
// First one is always a label
if (idx != 0) {
var selected = document.getElementById(selectname).options[idx].value;
var cmd = selectname.replace('_' + rte, '');
rteCommand(rte, cmd, selected);
//document.getElementById(selectname).selectedIndex = 0;
document.getElementById(selectname).selectedIndex = idx;

Precisely I've changed the following line in the above function

document.getElementById(selectname).selectedIndex = 0;

to the following line

document.getElementById(selectname).selectedIndex = idx;

and achieved the result you want.