Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > problem accessing document in generated iframe

Reply
Thread Tools

problem accessing document in generated iframe

 
 
sadie
Guest
Posts: n/a
 
      12-27-2007
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?





 
Reply With Quote
 
 
 
 
sadie
Guest
Posts: n/a
 
      12-27-2007
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 <(E-Mail Removed)> 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/




 
Reply With Quote
 
 
 
 
sadie
Guest
Posts: n/a
 
      12-27-2007
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 <(E-Mail Removed)> 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/




 
Reply With Quote
 
sadie
Guest
Posts: n/a
 
      12-27-2007
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 <(E-Mail Removed)> 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 <(E-Mail Removed)> 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/


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
form have 2 iframe.problem to input text in other iframe elca Python 0 10-21-2009 10:00 AM
code generated in IFRAME messed up by IE Joey33 Javascript 0 06-26-2007 11:23 AM
Get form values from iframe (1) to iframe (2) inside a layer in iframe (1) Daedalous Javascript 3 01-16-2004 11:08 AM
Problem refreshing iFrame with document.location.reload(true) bb Javascript 1 11-06-2003 12:37 PM
After the execution of frame.iframe.document.designMode="On" , I lost the access to iframe, it says permission denied bhaskarna@yahoo.com Javascript 0 07-17-2003 05:05 AM



Advertisments