Sunday, October 30, 2011

Invoking javascript in iframe from parent page


Invoking javascript in iframe from parent page

Suppose that you have base page page1.aspx.  and you have one iframe1 in page1.aspx call it popup1.
So code control will look like this:
<iframe name=" iframe1 " src="Popupl.aspx" height='280' width='770' frameborder='0' style="background-color: #F1F5FE;" ></iframe>

Suppose we write some function foo() on Popupl.aspx and we need same function on page1.aspx.
 Than can we access it?
Yes.
 By using following sytax:

window.frames. iframe1.foo();

No comments: