I have 2 pages-- Parent n child.
In the parent page i have an iframe whose value i want to fetch in the javascript of child page. Is there any way?....Please suggest.
I have 2 pages-- Parent n child.
In the parent page i have an iframe whose value i want to fetch in the javascript of child page. Is there any way?....Please suggest.
actually only
iframeElement
is needed.from inside child document:
and you're done.
Try giving a name to your iframe and acess the iframe like this
You can use
to get the value from the input element with the id "YOUR ID" from the parent.
You can get iframe's element in parent's document from inside the iframe this way:
Assuming that your page and frame structure is as follows
and that
you can access an element named 'iFrameElement' in the iframe using the following JavaScript statement from the child:
or simply the following from the parent containing the iframe
Since the frame name is indeterminate at runtime, you could revert to using the frame number in the window.frames array, as follows (from the child)
or from the parent
Use
to get the element. If you have multiple nested iframes, you can get the root parent by using
Either will work in your case.