Greetings,
I'm trying to create hyperlinks that place text at the cursor position. I've set up a JavaScript function, as follows:
function insert_into_editor(tag)
{
var oEditor = FCKeditorAPI.GetInstance('message');
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
{
// Insert the desired HTML.
oEditor.Focus();
oEditor.InsertHtml( tag ) ;
}
else
alert( 'You must be on WYSIWYG mode!' ) ;
return true;
}
Where "message" is the name of my FCK instance. Then somewhere in the HTML body, I have a link that calls the function:
<a onclick="insert_into_editor('{:FIRST-NAME:} ');">First Name</a>
In Firefox, this works properly. But in IE6 and IE7, the text is inserted AT THE BEGINNING of the editor, rather than at the current cursor position.
I've seen this question asked before, but I haven't seen any relevant solutions. Has anyone had this problem and solved it?
Thank you.
I'm trying to create hyperlinks that place text at the cursor position. I've set up a JavaScript function, as follows:
function insert_into_editor(tag)
{
var oEditor = FCKeditorAPI.GetInstance('message');
if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG )
{
// Insert the desired HTML.
oEditor.Focus();
oEditor.InsertHtml( tag ) ;
}
else
alert( 'You must be on WYSIWYG mode!' ) ;
return true;
}
Where "message" is the name of my FCK instance. Then somewhere in the HTML body, I have a link that calls the function:
<a onclick="insert_into_editor('{:FIRST-NAME:} ');">First Name</a>
In Firefox, this works properly. But in IE6 and IE7, the text is inserted AT THE BEGINNING of the editor, rather than at the current cursor position.
I've seen this question asked before, but I haven't seen any relevant solutions. Has anyone had this problem and solved it?
Thank you.
RE: InsertHTML puts text at beginning SOLVED
<a href="#" onclick="insert_into_editor('{:FIRST-NAME:} ');return false;">First Name</a>
did the trick.
Re: InsertHTML puts text at beginning of editor