I have been trying to modify slightly an old online wysiwyg that is based on an iframe.
var s_selected = window.getSelection();
var o_element = document.getElementById("idContent");
o_element.innerHTML = o_element.innerHTML.replace(s_selected, "<span style='background:#FF0000'>" + s_selected + "</span>");
Looking at the source codes of hundreds of wysiwygs today I noticed that there's something like pasteHTML, but I couldn't make that work, either. Also tried to use getIFrameDocument instead of getElementById but to no avail, error is printed idContent is not defined all the time.
Can anybody help me here?
Thanks in advance!
pasteHTML is a "feature" of IE browsers that isn't supported by most other web browsers.
This Introduction to Ranges provides good resources in regard to working with text selections.