By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,622 Members | 1,826 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,622 IT Pros & Developers. It's quick & easy.

Referencing elements within an iframe in Firefox.

P: n/a
I've written several utility pages that use a dynamically created
iframe. The iframe typically has a form that is populated by the main
page. Then the form is submitted to be processed, and the returning
page does something -- call a function on the main page, change a
variable on the main page, etc.

All this stuff I created works on IE. Sorry, didn't have other browsers
available to test. Now I have access to a machine with FF, and none of
these scripts work.

So, short and sweet: What is the proper way to reference a form on an
iframe from the parent doc in firefox? Also, call a function from the
parent to the iframe, and vice-versa, call a function on the parent doc
from the iframe when it loads?

TIA...

Jul 23 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Did you check the error messages in the Tools/JavascriptConsole ?
Have a look also in the Tools/DOM inspector.

"Razzbar" <gl***@potatoradio.f2s.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
I've written several utility pages that use a dynamically created
iframe. The iframe typically has a form that is populated by the main
page. Then the form is submitted to be processed, and the returning
page does something -- call a function on the main page, change a
variable on the main page, etc.

All this stuff I created works on IE. Sorry, didn't have other browsers
available to test. Now I have access to a machine with FF, and none of
these scripts work.

So, short and sweet: What is the proper way to reference a form on an
iframe from the parent doc in firefox? Also, call a function from the
parent to the iframe, and vice-versa, call a function on the parent doc
from the iframe when it loads?

TIA...

Jul 23 '05 #2

P: n/a
Razzbar wrote:
I've written several utility pages that use a dynamically created
iframe. The iframe typically has a form that is populated by the main
page. Then the form is submitted to be processed, and the returning
page does something -- call a function on the main page, change a
variable on the main page, etc.

All this stuff I created works on IE. Sorry, didn't have other browsers available to test. Now I have access to a machine with FF, and none of these scripts work.

So, short and sweet: What is the proper way to reference a form on an
iframe from the parent doc in firefox? Also, call a function from the
parent to the iframe, and vice-versa, call a function on the parent doc from the iframe when it loads?

TIA...


Should be something here...

http://www.faqts.com/knowledge_base/index.phtml/fid/127

Jul 23 '05 #3

P: n/a

Paul J. Le Genial wrote:
Did you check the error messages in the Tools/JavascriptConsole ?
Have a look also in the Tools/DOM inspector.


Yes, but the information wasn't useful. It's a compatibility issue,
with IE being non-DOM compliant in the way you refer to an iframe.

I found the DOM way to address the iframe here,
http://www.codingforums.com/showthread.php?t=45000

Basically, the DOM way to refer to an iframe element from the parent
doc is
document.getElementById('iframeId').contentDocumen t.getElementById('elementID')

While the IE way is
document.frames['frameName'].elementName

Jul 23 '05 #4

P: n/a
Should be. Seperating the wheat from the chaff is the problem. Most of
those examples are not crossbrowser solutions. There doesn't seem to be
one way that works with IE
and the DOM.

Jul 23 '05 #5

P: n/a
Razzbar wrote:
Should be. Seperating the wheat from the chaff is the problem. Most of those examples are not crossbrowser solutions. There doesn't seem to be one way that works with IE
and the DOM.


iframes are unusual in that they are represented in the DOM by *two*
host objects, an HTMLElement object & a window (frame) type object.
Which one you access depends, naturally, on what you need to do with
it. To allow cross-referencing, the special properties 'contentWindow'
and 'contentDocument' were created.

http://mips.ath.cx/js-iframe-content.html

Jul 23 '05 #6

P: n/a

"Razzbar" <gl***@potatoradio.f2s.com> wrote in message news:11*********************@o13g2000cwo.googlegro ups.com...

I found the DOM way to address the iframe here,
http://www.codingforums.com/showthread.php?t=45000

Basically, the DOM way to refer to an iframe element from the parent doc is
document.getElementById('iframeId').contentDocumen t.getElementById('elementID')


For the frames method, you can get to the iframe's doc (cross browser) with:
window.frames[frameIdentifier].document...

IE can also do (note capitalization):
document.getElementById('iframeId').Document.getEl ementById('elementID')
document.getElementById('iframeId').Document.all['elementID']
Csaba Gabor from Vienna
Jul 23 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.