PDA

View Full Version : RTE and Display font



andyc209
12-08-2009, 01:08 PM
1) Script Title: Rich Text Editor

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/richtexteditor/index.htm

3) Describe problem: How can I change the font on the texarea from Times to arial?I have tried styling the textarea in the script but it does not work (see below).
thanks for any info

.
.
.
if (!readOnly) {
document.writeln('<textarea name="' + rte + '" id="' + rte + '" style="width: ' + width + 'px; height: ' + height + 'px; font-family: arial, sans-serif; font-size:0.80em;">' + html + '</textarea>');
} else {
document.writeln('<textarea name="' + rte + '" id="' + rte + '" style="width: ' + width + 'px; height: ' + height + 'px; font-family: arial, sans-serif; font-size:0.80em;" readonly>' + html + '</textarea>');
}
.
.
.

jscheuer1
12-08-2009, 05:45 PM
Don't edit the script, then you can't used the compressed version. Make up a style sheet, call it -say, myEdit.css and put this in it:


body {
background: #fff;
margin: 0px;
padding: 0px;
font-family: arial, helvetica, sans-serif;
}

The highlighted lines should remain unchanged. If you change the background, you may need to add a color property to keep the text readable.

Put this file in the same folder as your page with the RTE on it. Then where you do something like this in your page's code:


initRTE("images/", "", "");

make it:


initRTE("images/", "", "myEdit.css");

That will change the default font for the editor to Arial.

andyc209
12-11-2009, 10:46 AM
thanks for that,great fix