PDA

View Full Version : access all tags inside iframe



sugata_bhar
09-07-2006, 07:48 AM
<HTML>
<HEAD>
<script type="text/javascript">
function init(){
var nodes = window.frames.anIframe.document.links;
alert(nodes.item(2).text);
}
</script>
</head>
<BODY onLoad="init()">
<A HREF="javascript: void 0"
ONMOUSEOVER="window.frames.anIframe.location.href =
'http://JavaScript.FAQTs.com'"
>
JavaScript.FAQTs.com
</a>
<BR>
<IFRAME NAME="anIframe" SRC="http://www.FAQTs.com"
WIDTH="400"></iframe>
</body>
</html>

This is my code.
but it is giving an error of "access denied"
please tell me how to access content inside an iframe

felgall
09-07-2006, 07:54 AM
The code will work provided that the content of the iframe comes from the same domain as the main page. If it comes from a different domain then security mmakes it impossible for Javascript to reference the iframe and there is nothing you can do to change it.