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
=======









About Vineet Verma

Developer/Blogger/Gamer/Lazy Couch Potato...:P Need PDF Books: Knowledge Base
This entry was posted in HTML. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s