473,385 Members | 1,983 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Referencing elements within an iframe in Firefox.

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
6 10925
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
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

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
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
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

"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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: hibernate | last post by:
I'm somewhat new to javascript/DHTML, and this problem has been plaguing me. I have made an 'array' of <div> tags within my html document like so: <div id="menu"> menu1 </div> <div id="menu">...
6
by: NoCopy na | last post by:
Using the following example: domiframetest.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html...
5
by: David | last post by:
Hey, I'm not quite sure where to post this, but I believe this is the most appropriate place. I have a page I am creating that does a submission within a hidden IFRAME every time someone adds...
13
by: ukrbend | last post by:
I'm new to Javascript and to html and am trying to make the following code snippet work but it doesn't. It refuses to call the getPage() function and I always get a 404 error. I know the code is...
3
by: cweeks | last post by:
I am using the Webbrowser control in VS 2005 C# Express to automate the navigation of pages on a partner's web site. The first page contains an <IFRAME> element: <iframe style='width:40;...
3
by: Jeremy | last post by:
If we have an iframe loaded from the same domain as the parent document, how can we (is it possible) to execute a function on the parent document's page? e.g. 1) On parent page:...
3
by: Daz | last post by:
Hi everyone. I have just been making a JavaScript chat applet, which should open in a new child window. It does all of this fine, and works within Firefox beatifully. However, IE thinks it's...
3
by: dhanasekaran1980 | last post by:
Hi, I am using IFRAMES to load 3rd party domains in my website. I am facing few problems using IFRAMES in IE and Firefox. 1) I am unable to login into the 3rd party website within the IFRAME....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.