§ Auto replace textareas with fckeditor
Simple function to replace any textarea with fckeditor.
Include this javascript and all textareas (with 'Desc' in their name, as written) will be replaced by fckeditor.
function ReplaceDescTextareas() {
// replace all of the textareas that have 'Desc' in their name
var allTextAreas = document.getElementsByTagName("textarea");
for (var i=0; i <allTextAreas.length; i++) {
if(allTextAreas[i].name.indexOf('Desc')>-1)
{
var oFCKeditor = new FCKeditor( allTextAreas[i].name ) ;
var pth=window.location.pathname;
pth=pth.substring(0,pth.lastIndexOf('/'))+'/fckeditor/';
oFCKeditor.BasePath = pth ;
oFCKeditor.Height = 400;
oFCKeditor.Config['SkinPath'] = 'skins/silver/' ;
oFCKeditor.ReplaceTextarea() ;
}
}
}
function makeDoubleDelegate(function1, function2) {
return function() {
if (function1)
function1();
if (function2)
function2();
}
}
window.onload = makeDoubleDelegate(window.onload, ReplaceDescTextareas );
last edited on January 29th, 2009 at 1:21 PM
Categories
Comments
- Slashback on "window.onload via double delegate function" - The makeDoubleDelegate() function is rather simple and straightforward, so I find it quite odd that Chrome can't handle it. I do…
- Joaquin Serra on "window.onload via double delegate function" - Hello, i'm using this function one year but i realized now that in Google chrome doesn't work. Have you got some solution?
- tadd on "Javascript function to add css" - thanks for the post
- Slashback on "window.onload via double delegate function" - The makeDoubleDelegate function just needs to be available, so include it once somewhere in your html file or an included javascript…
- Neil Haskins on "window.onload via double delegate function" - I don't understand exactly how this is to be used; I've just used javascript in a cut and paste manner really. Does the whole code go…