0

Possible Duplicate:
How to call a function in an iframe from the parent page?

How Call javascript function inside iframe from parent?

Community
  • 1
  • 1
ali mousavi
  • 51
  • 1
  • 3

2 Answers2

0

If the iframe is not from the same domain as the parent's page(including using the same protocol, and sub domain) then this isn't possible, but if from the same domain using the same protocol:

To call a function the parent has from the iframe: parent.functName()

To call a function in the iframe from the parent: window.frames.iframeID.functName();

SReject
  • 3,774
  • 1
  • 25
  • 41
0
$('#iframeid').get(0).contentWindow.yourfunction()

that's the jQuery way

if you want to call a function in parent from the ifreme, just use

window.top.yourfunction()

Reflective
  • 3,854
  • 1
  • 13
  • 25