problem accessing document in generated iframe

Discussion in 'Javascript' started by sadie, Dec 27, 2007.

  1. sadie

    sadie Guest

    Hi,

    I'm having some trouble accessing a form in a generated iframe. I can
    only access the frame using the document.getElementById() method (the
    frame is not in the frames array since it is dynamically generated)
    and then I cannot seem to then get access to the document inside the
    frame.

    //this returns a frame element
    frm = document.getElementById("frame1");

    //returns undefined
    alert(frm.document);

    ultimately I am trying to access a form inside the frame.

    Any ideas?
    sadie, Dec 27, 2007
    #1
    1. Advertising

  2. sadie

    sadie Guest

    That's not possible with the logic of my app. I'm trying to use the
    iFrame within a google maps infoWindow, so there isn't anywhere to
    hard-code it in the page. Is there any other way to access the frame
    document??




    On Dec 27, 3:57 pm, Randy Webb <> wrote:
    > sadie said the following on 12/27/2007 1:38 AM:
    >
    >
    >
    > > Hi,

    >
    > > I'm having some trouble accessing a form in a generated iframe. I can
    > > only access the frame using the document.getElementById() method (the
    > > frame is not in the frames array since it is dynamically generated)
    > > and then I cannot seem to then get access to the document inside the
    > > frame.

    >
    > > //this returns a frame element
    > > frm = document.getElementById("frame1");

    >
    > > //returns undefined
    > > alert(frm.document);

    >
    > > ultimately I am trying to access a form inside the frame.

    >
    > > Any ideas?

    >
    > Put the IFrame into the page hard-coded. Then hide it using CSS. Then,
    > instead of creating it dynamically, simply un-hide it.
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
    > Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
    sadie, Dec 27, 2007
    #2
    1. Advertising

  3. sadie

    sadie Guest

    That's not possible with the logic of my app. I'm trying to use the
    iFrame within a google maps infoWindow, so there isn't anywhere to
    hard-code it in the page. Is there any other way to access the frame
    document??




    On Dec 27, 3:57 pm, Randy Webb <> wrote:
    > sadie said the following on 12/27/2007 1:38 AM:
    >
    >
    >
    > > Hi,

    >
    > > I'm having some trouble accessing a form in a generated iframe. I can
    > > only access the frame using the document.getElementById() method (the
    > > frame is not in the frames array since it is dynamically generated)
    > > and then I cannot seem to then get access to the document inside the
    > > frame.

    >
    > > //this returns a frame element
    > > frm = document.getElementById("frame1");

    >
    > > //returns undefined
    > > alert(frm.document);

    >
    > > ultimately I am trying to access a form inside the frame.

    >
    > > Any ideas?

    >
    > Put the IFrame into the page hard-coded. Then hide it using CSS. Then,
    > instead of creating it dynamically, simply un-hide it.
    >
    > --
    > Randy
    > Chance Favors The Prepared Mind
    > comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
    > Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
    sadie, Dec 27, 2007
    #3
  4. sadie

    sadie Guest

    Ok, I found a work around where I don't need to access the frame
    document from the parent page, but I'm still curious if there was
    anyway to do it and if not why?

    btw, thanks for the quick reply Randy.




    On Dec 27, 5:48 pm, sadie <> wrote:
    > That's not possible with the logic of my app. I'm trying to use the
    > iFrame within a google maps infoWindow, so there isn't anywhere to
    > hard-code it in the page. Is there any other way to access the frame
    > document??
    >
    > On Dec 27, 3:57 pm, Randy Webb <> wrote:
    >
    > > sadie said the following on 12/27/2007 1:38 AM:

    >
    > > > Hi,

    >
    > > > I'm having some trouble accessing a form in a generated iframe. I can
    > > > only access the frame using the document.getElementById() method (the
    > > > frame is not in the frames array since it is dynamically generated)
    > > > and then I cannot seem to then get access to the document inside the
    > > > frame.

    >
    > > > //this returns a frame element
    > > > frm = document.getElementById("frame1");

    >
    > > > //returns undefined
    > > > alert(frm.document);

    >
    > > > ultimately I am trying to access a form inside the frame.

    >
    > > > Any ideas?

    >
    > > Put the IFrame into the page hard-coded. Then hide it using CSS. Then,
    > > instead of creating it dynamically, simply un-hide it.

    >
    > > --
    > > Randy
    > > Chance Favors The Prepared Mind
    > > comp.lang.javascript FAQ -http://jibbering.com/faq/index.html
    > > Javascript Best Practices -http://www.JavascriptToolbox.com/bestpractices/
    sadie, Dec 27, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. elca
    Replies:
    0
    Views:
    562
  2. Replies:
    0
    Views:
    488
  3. bb
    Replies:
    1
    Views:
    157
    Thomas 'PointedEars' Lahn
    Nov 6, 2003
  4. Daedalous
    Replies:
    3
    Views:
    663
    Daedalous
    Jan 16, 2004
  5. Joey33
    Replies:
    0
    Views:
    62
    Joey33
    Jun 26, 2007
Loading...

Share This Page