Are the parent document and the iframe document in the same domain? If they are coming from different servers you would kit browser security restrictions with this.
--->N .:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.:||:._.: ||:. Nathan Young Cisco.com->Interface Development A: ncy1717 E: [EMAIL PROTECTED] > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of James Thomas > Sent: Friday, February 09, 2007 9:27 AM > To: [email protected] > Subject: [jQuery] Finding parent iframe? > > > I have a quandary. I open an iframe with some arbitrary > content in it. I want > to be able to click on something within the iframe to cause > the iframe (and > the div tag that contains the iframe) to go away. I am having trouble > getting to the iframe. I know it's possible as I've seen it > elsewhere, I > just can't find the proper path to it. > > I basically have this structure: > > <html> > <body> > <div> > <iframe> > <html> > <body> > <any tag> > </body> > </html> > </iframe> > </div> > </body> > </html> > > It's not exactly accurate but it gives a good idea what I'm > looking to do > > I've tried: > > // This should as far as I can get to the div tag which is > where I want to > be > $('#any tag').parents('html').parent().parent(); > > But when I alert the length of this, I get 0. I've also tried > a pure DOM way > any_tag.ownerDocument.parent.parent.parent > but again, I get nothing. > > Firebug tells me I should get something as it displays my > whole hierarchy, > which is as follows: > input.#img < div < td < tr < tbody < table < div.rdgrey < > form#Form1 < body > < html < iframe < div < body < html > and when I alert > $('input#img').parents('html').length > I get one so I know it's getting this far. > > Any thoughts? > > Thanks, > > James > > > > > -- > View this message in context: > http://www.nabble.com/Finding-parent-iframe--tf3201657.html#a8889892 > Sent from the JQuery mailing list archive at Nabble.com. > > > _______________________________________________ > jQuery mailing list > [email protected] > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list [email protected] http://jquery.com/discuss/
