开发者

Iframes, child pages and functions

开发者 https://www.devze.com 2023-03-14 11:23 出处:网络
I have an aspx page with some controls. One of which is an iframe, whose source changes (depending on the selection in a listbox). So, if a user selects an item in the listbox (ie: Claims.aspx), the i

I have an aspx page with some controls. One of which is an iframe, whose source changes (depending on the selection in a listbox). So, if a user selects an item in the listbox (ie: Claims.aspx), the iframes source changes to Claims.aspx.

I have a button on my 'child' pages (ie: Claims.aspx). I'd really like to have that button execute either:

  1. Javascript from the 'parent' page
  2. A VB function in the code-behind of the 'parent' page

Is the开发者_JAVA百科re any way to do this?


If your parent page and your content page are both on the same domain (which I'm presuming they are) you can simply do:

parent.myFunction();

from your content page to access myFunction() in your parent page.


Similar to Town's answer, you can also use top as in

top.myFunction();

to call the parent's myFunction function from the Iframe.

0

精彩评论

暂无评论...
验证码 换一张
取 消