views:

5008

answers:

2

I have a iFrame content which is having inside another iFrame. I want to get inside iFrame src content. how can i do this using javascript?

A: 

iframeInstance.contentWindow.document - this document loaded from SRC url. and vice verse - to get from inner document to parent use: parent.document

Dewfy
i got src of outer iframe. if i want the inner iframe src how can i get ? can u pls give me an example regarding my question ? thanks.
paulrajj
A: 

The outer page:

<html>
<body>
<iframe id="ifr1" src="page1.htm"></iframe>
<iframe id="ifr2" src="http://www.google.com"&gt;&lt;/iframe&gt;
</body>
</html>

page1.htm:

<html>
<body>
<script type="text/javascript">
document.write(parent.document.getElementById('ifr2').src);
</script>
</body>
</html>
Joshua
i cant get my actual result, but may this answer helpful to me.. thanks..
paulrajj