Problem opening page in dynamically generated iframe

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Malkalypse

    Problem opening page in dynamically generated iframe


    Hello, I have been having some trouble with this one, so I decided to
    strip it down to its simplest form. I think I found the root of the
    problem, but I don't know how to solve it.

    I need a link in one iframe to open a page in a different iframe. I can
    do this normally:



    But, when the iframes are dynamically generated (created via a
    javascript function), the target id does not seem to be recognized, and
    the content is opened in a new window:



    I need to get the second page working like the first one. Can anyone
    tell me what I'm doing wrong?


    --
    Malkalypse
    ------------------------------------------------------------------------
    Malkalypse's Profile: http://www.highdots.com/forums/member.php?userid=23
    View this thread: http://www.highdots.com/forums/showthread.php?t=1519468

  • Jc

    #2
    Re: Problem opening page in dynamically generated iframe

    Malkalypse wrote:[color=blue]
    > Hello, I have been having some trouble with this one, so I decided to
    > strip it down to its simplest form. I think I found the root of the
    > problem, but I don't know how to solve it.
    >
    > I need a link in one iframe to open a page in a different iframe. I can
    > do this normally:
    >
    > http://www.jonesmfgmusic.com/test/test1/
    >
    > But, when the iframes are dynamically generated (created via a
    > javascript function), the target id does not seem to be recognized, and
    > the content is opened in a new window:
    >
    > http://www.jonesmfgmusic.com/test/test2/
    >
    > I need to get the second page working like the first one. Can anyone
    > tell me what I'm doing wrong?
    >
    >
    > --
    > Malkalypse
    > ------------------------------------------------------------------------
    > Malkalypse's Profile: http://www.highdots.com/forums/member.php?userid=23
    > View this thread: http://www.highdots.com/forums/showthread.php?t=1519468[/color]

    AFAIK, you're not doing anything wrong, there seems to be an issue in
    IE with setting the name property on an element created using
    createElement. Refer to:


    I added an alert to show document.body.i nnerHTML, and the name property
    doesn't seem to be getting set properly. Interestingly, I did find that
    the following code seems to work in IE:

    var TargetFrame = document.create Element("<ifram e name='Target'>" );

    I didn't test it, but the linked thread suggests trying innerHTML or
    insertAdjacentH TML to create the iframe in IE.

    Comment

    Working...