besla
08-14-2002, 10:14 PM
Hi, I try write function for put class definiton in <P> tag in wysiwyg editor. I have problem because I use execCommand method which hasn't command for insert class attribute.
How I can put unspecific class tag with execCommand method in IFRAME ? If somebody now any solution for it i'll be grateful.
For example:
When I selected some text from IFRAME I wish receive this
<P class=xyz>selected text</P> ON SAME PLACE WHERE SELECTED TEXT WAS.
Problem with this function is because that put selected text to end of page. How I can put text on same place ?
function InsertClass (cmd,opt) {
var strStart,strEnd,A;
//copy selected text to clipboard
idContent.document.execCommand('copy',"",opt);
strStart="<P class=xyz>";
strEnd=</P>;
// convert TextMode in HTMLMode
A=idContent.document.body.innerHTML;
idContent.document.body.innerText=A;
idContent.focus();
idContent.document.execCommand('paste',"",strStart);
idContent.document.execCommand('paste',"",opt);
idContent.document.execCommand('paste',"",strEnd);
// convert TextMode in HTMLMode
A=idContent.document.body.innerText
idContent.document.body.innerHTML=A;
idContent.focus();
}
Sorry about my little english.
How I can put unspecific class tag with execCommand method in IFRAME ? If somebody now any solution for it i'll be grateful.
For example:
When I selected some text from IFRAME I wish receive this
<P class=xyz>selected text</P> ON SAME PLACE WHERE SELECTED TEXT WAS.
Problem with this function is because that put selected text to end of page. How I can put text on same place ?
function InsertClass (cmd,opt) {
var strStart,strEnd,A;
//copy selected text to clipboard
idContent.document.execCommand('copy',"",opt);
strStart="<P class=xyz>";
strEnd=</P>;
// convert TextMode in HTMLMode
A=idContent.document.body.innerHTML;
idContent.document.body.innerText=A;
idContent.focus();
idContent.document.execCommand('paste',"",strStart);
idContent.document.execCommand('paste',"",opt);
idContent.document.execCommand('paste',"",strEnd);
// convert TextMode in HTMLMode
A=idContent.document.body.innerText
idContent.document.body.innerHTML=A;
idContent.focus();
}
Sorry about my little english.