Hi guys. Does anyone know the counterpart of Javascript's .pasteHTML method in Firefox and other browsers? It works fine only in IE. I'm using an FCK Editor as my WYSIWYG control. Here is my code snippet:

var oFCKeditor = FCKeditorAPI.GetInstance(objname);
var selection = (oFCKeditor.EditorWindow.getSelection ? oFCKeditor.EditorWindow.getSelection() : oFCKeditor.EditorDocument.selection);
var sRange;
var sHtml;

//IE
if(selection.createRange) 
{
	sRange = selection.createRange();
	sHtml = sRange.htmlText;
}
//Other Browsers
else 
{
	sRange = selection;
	sHtml = sRange;
}

sRange.pasteHTML(str1 + sHtml + str2);

What I'm trying to do is to insert an HTML code to a selected range. I'd appreciate your help on this. TIA.

There's none I'm afraid. Or at least not a coder-friendly one. Other browsers have just recently stared supporting some of rich-text html editor commands and already made a mess out of it. There are to many stunt steps required and hope for the best in the end for it to make it happen.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.