Dealing with frames can be a bit tricky.  The syntax you describe below is
an IE-only solution.  There are some different ways to access the document
within the frame.

All browsers support window.frames[] as an indexer.  If there is only one
frame on the page, window.frames[0] will work.

You can also access that indexer by the name of the frame.

<iframe name='frame1' src='about:blank'></iframe>

window.frames['frame1']

Will return the document.  Unfortunately, you have to have the name
property.  Only IE can access the iframe document by id that way.

Also, if you have the iframe element, all browsers support the contentWindow
property.

document.getElementById('iframeid').contentWindow.document

Will return the document of the frame.

All browsers except IE support the contentDocument property.

document.getElementById('iframeid').contentDocument

I've thrown up a sample page here:

http://cobalt.scorpiontechnology.com/texteditor.htm

So you can see the results in different browsers.

You'll note in the source code for that page that I put the function in a
0-length timeout script.  Firefox is picky about accessing the frame
document and the $(document).ready function is too soon in the page
lifecycle.

As another note, Safari 2 on the Mac is a complete horrible beast when it
comes to iframes.  The simple page I just threw up there worked fine the
first time, but when I refreshed it the window.frames indexer crashed.

JK

-----Original Message-----
From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of chrismarx
Sent: Thursday, November 15, 2007 3:26 AM
To: jQuery (English)
Subject: [jQuery] Selectors in IFrame


What would be a jQuery equivalent for this


iFrameTable.document.getElementsByTagName("td")


if iFrameTable is the id of the iframe?

Reply via email to