Click to See Complete Forum and Search --> : Access content of an Iframe
Volker
03-17-2003, 12:11 PM
I have the following problem:
I created a Form with an IFrame inside. This frame holds a subform.
Like this:
<FORM id="1">
.
.
<IFRAME id="fr2" src="frm2.htm" ...></IFRAME>
.
.
<FORM>
With a little javascript, that is called when Form 1 is submitted, I send the content of Form frm2 to the program that processes the data, prior to the content of Form 1.
This works as long as Form 1 is displayed inside the top browser window. When the form is displayed inside a frame the script can't access the content of form 2 anymore.
Any suggestions?
:confused:
First I'd say that you need to change the ID of the first one to "one" or "id1" instead of just the numeral "1." It's just a suggestion.
You should be able to access the innerHTML of the IFrame. Try that.
Volker
03-18-2003, 09:22 AM
Hi,
the original frames have names, not just numbers.
khaki
03-18-2003, 09:55 AM
Volker wrote: This works as long as Form 1 is displayed inside the top browser window. When the form is displayed inside a frame the script can't access the content of form 2 anymore.It's funny... you use iframes, yet you are also still using frames.
As someone who has followed a lot of threads in this forum, it appears that lately many of the problems that I read about seem to center around finding work-arounds for using frames.
It appears that frames and tables are really becoming exposed for their limitations as more advanced techniques are implemented into web development.
Maybe this is more commentary than solution for you Volker (sorry :( ). There is probably a solution for you out there, but maybe just re-think the use of frames(?).
:) k
khalidali63
03-18-2003, 10:10 AM
to access objects between frames,you have to follow the patter
parent.frames[frameIndex].document.getElementById....
and so on.
you can use parent .frameName as well..but my fav is with the index
:D
Cheers
Khalid
Volker
03-20-2003, 12:34 PM
Thank You for the help,
I found out that the problem only occured when the IFRAME is resides in a Form which is within a Frame of an Frameset.
So I substituted the Framset of the Mainpage with a Table that holds 4 IFRAMES with the same Names as the original FRAMES.
The structure is like this:
<TABLE>
<IFRAME>
<FORM>
<IFRAME>
<FORM>
The Application still works fine.
Now I can access the Sub-Forms inside of the Sub-IFRAMES.
Don't know if this is a Problem only of IE6.
CU
Volker :D