How to access embedded iframe’s internal elements?

How do I access internal form elements of iframe which is embedded in an HTML page.

Ofcourse document.forms[0] will give me the first form in the parent document. But what I need is the form of the iframe.

Here is the solution

Example:
Test.html
==========


Dynamic Content

function testFun()

{
var doc = document.getElementById('myframe').contentWindow.document;
alert(doc.forms[0].textbox.value);
}




http://b.html




b.html
=======









Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.