Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Apr 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Link insertor Firefox

    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.

  • #2
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    pasteHTML sounds like it is IE only.....too lazy to look it up.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #3
    New Coder
    Join Date
    Apr 2004
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Lord_Garfield yoyu might want to check out:

    frames.my_editor.document.pasteHTML() equivalent in firefox??

    Cheers

    Jody


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •