homerUK
11-28-2002, 01:12 PM
hi,
I have a main window (an iFrame) called "iView". This allows users to submit text text.... I want them to be able to add some predefined text as well..... so they would click a link which opens up a new window with two sentances in it.
eg:
insert - "hello world"
insert - "testing123"
I can get these to be inserted as basic text using the following function:
function insertText(theText)
{
window.opener.iView.focus();
window.opener.iView.document.selection.createRange().text = theText;
}
then the sentance to insert would look like:
<a href="javascript:insertText('hello world');">Insert - hello world</a>
but...
I want to have the text inserted to be formatted... so when the sentance is selected from the popup window, it would add
"<b>Hello</b><em>World</em>"
or something similar......
when I add the above formatting to the link, it doesnt seem to work.
so the link would look like:
<a href="javascript:insertText('<b>Hello</b><em>World</em>');">Insert - hello world</a>
Any ideas??
Thanks.
I have a main window (an iFrame) called "iView". This allows users to submit text text.... I want them to be able to add some predefined text as well..... so they would click a link which opens up a new window with two sentances in it.
eg:
insert - "hello world"
insert - "testing123"
I can get these to be inserted as basic text using the following function:
function insertText(theText)
{
window.opener.iView.focus();
window.opener.iView.document.selection.createRange().text = theText;
}
then the sentance to insert would look like:
<a href="javascript:insertText('hello world');">Insert - hello world</a>
but...
I want to have the text inserted to be formatted... so when the sentance is selected from the popup window, it would add
"<b>Hello</b><em>World</em>"
or something similar......
when I add the above formatting to the link, it doesnt seem to work.
so the link would look like:
<a href="javascript:insertText('<b>Hello</b><em>World</em>');">Insert - hello world</a>
Any ideas??
Thanks.