/    Sign up×
Community /Pin to ProfileBookmark

jscript pasteHTML

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 ?

to post a comment
JavaScript

3 Comments(s)

Copy linkTweet thisAlerts:
@KorJan 14.2004 — Try

'<A HREF=[color=red][/color]'Page.jsp[color=red][/color]'>'



or



'<A HREF=[color=red]"[/color]Page.jsp[color=red]"[/color]>'
Copy linkTweet thisAlerts:
@clairec666Jan 14.2004 — The problem is with the quotation marks:

You should use the following:

javascript:editor_insertHTML('textFR','<A HREF='Page.jsp'>','</A>');
Copy linkTweet thisAlerts:
@igwaneauthorJan 14.2004 — sorry but the problem is not with the '

I forgot to write it down in the message ?

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 ?
×

Success!

Help @igwane spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...