If you have created a rich text editor using Javascript’s execCommand and an IFRAME and you intend to use the output inside a Flash textfield, then you may have to change the output from your RTE for the bold, italic and underline commands.
execCommand() for making the selection inside the IFRAME bold will give out something like this:
- <span style=”font-weight: bold;”>Bold text</span>
And flash expects it to be
In this situation you can use a bit of regex to convert the style based <span> element to a <b> element like this
//get the content first
var rte_content = document.getElementById(‘rte_content’);
//put it in a string
var str = oRTE.document.body.innerHTML;
//replace the content
str = str.replace(/<span style=”font-weight: bold;”>(.+?)<\/span>/g,’<b>$1</b>’)
Now you can pass the ’str’ to a hidden form element or whichever way you are using to post the content. The same applies to italic and underline…