...

View Full Version : Link insertor Firefox



Lord_Garfield
04-12-2005, 09:00 AM
Hi,

I have a problem with a linkinsertor. I can not manage to paste HTML code in a Iframe in firefox. It all works in IE but not Firifox.

the function fill_exlinkn works.
It simply gets the selected text if there is selcted text and puts it in a variable. This will be used between the 'a' tags.
form1.exlinkn.value is a textbox in this pop up window where you can still change the external link name.

the other function submit_link does not work in FF.

What should I do to get it work in FF?
what is the correct replacement for
window.opener.frames[naam].focus();
selection.pasteHTML(exlink);

here is my function code:

var naam = "<?php echo $_GET['naam']; ?>";
var selection;
var isFF;
function fill_exlinkn()
{
var ua = navigator.userAgent.toLowerCase();
isFF = (ua.indexOf("gecko") != -1);
if (!isFF)
{
selection = window.opener.frames[naam].document.selection.createRange();
exlinknaam = selection.text;
}
else
{
//window.opener.document.getElementById(naam).contentWindow.focus();
selection = window.opener.document.getElementById(naam).contentWindow.getSelection();
exlinknaam = selection;
}
document.form1.exlinkn.value = selection;
}
function submit_link()
{
if (document.form1.exlinkn.value == "")
{
exlink = "<a href=" + form1.link_type.value + form1.exlink.value + " target=_blanc>" + form1.exlink.value + "</a>";
}
else
{
exlink = "<a href=" + form1.link_type.value + form1.exlink.value + " target=_blanc>" + form1.exlinkn.value + "</a>";
}
if (!isFF)
{
window.opener.frames[naam].focus();
selection.pasteHTML(exlink);
}
else
{
window.opener.document.getElementById(naam).contentWindow.focus();
window.opener.document.getElementById(naam).contentWindow.getSelection().pasteHTML(exlink);
}
window.close();
}


best regards.

A1ien51
04-12-2005, 07:36 PM
pasteHTML sounds like it is IE only.....too lazy to look it up.

Eric

Lord_Garfield
04-13-2005, 08:10 AM
I'm looking it up but I would like some sugestions.

Most of it It is about changing the innerHTML of the iframe but to get inner HTML I need another way to check if it is selected. It is so complex at the moment. I think there is an easy way to so if anybody knows a good way to do this I would appreciate.

(or a working way becouse at the moment I'm not able to get it to work.)

tanks.

saltpot
07-05-2005, 05:48 PM
Lord_Garfield yoyu might want to check out:

http://www.codingforums.com/showthread.php?t=62782

Cheers

Jody



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum