Click to See Complete Forum and Search --> : jscript pasteHTML


igwane
01-14-2004, 04:13 AM
Hi,

I've got a little problem using a javascript fonction : pasteHTML

see code and problems below

Thanks in advance for replies ;)



function editor_insertHTML(objname, str1,str2) {

var config = document.all[objname].config;

var editor_obj = document.all["_" +objname + "_editor"]; // editor
object

var editdoc = editor_obj.contentWindow.document;

sRange = editdoc.selection.createRange();

var sHtml = sRange.htmlText;

sRange.pasteHTML(str1 +sHtml+ str2);

}



Here is the link to function :

javascript:editor_insertHTML('textFR','<A HREF=\'Page.jsp\'>','</A>');



Here is the code added to my iframe :

<A

href="http://www.urltest.com/admin/Page.jsp">test</A>



I would like to have: <A href="Page.jsp">test</A>

Any idea ?

Kor
01-14-2004, 05:06 AM
Try

'<A HREF=\'Page.jsp\'>'

or

'<A HREF="Page.jsp">'

clairec666
01-14-2004, 05:09 AM
The problem is with the quotation marks:
You should use the following:
javascript:editor_insertHTML('textFR','<A HREF=\'Page.jsp\'>','</A>');

igwane
01-14-2004, 09:31 AM
sorry but the problem is not with the '
I forgot to write it down in the message :D
I have no script error
but it doesn't do what it should do

It seems to be a pasteHTML problem

But as anyone a solution for this ?