-1

Possible Duplicate:
Iframe Function Calling From Iframe to parent page javascript function

I have a JavaScript function written in my main page. It's a function that slides up the div "toggle" (with jquery).

This main page contains an iframe that is embedded into the div#toggle.

When I click on a link that belongs to the iframe I would like to execute the slide up function.

I put an onclick event on a link in the iframe (to trigger the function declared in my main page) but it doesn't work. Well, I'm not that surprised but I don't know how to make it work.

Does anyone has an idea ?

Community
  • 1
  • 1
Vincent Roye
  • 2,751
  • 7
  • 33
  • 53

1 Answers1

1

You can use window.parent to access the containing page:

window.parent.someToggleFunc();

Note that Javascript access between iframes like this are subject to the Same Origin Policy.

roryf
  • 29,592
  • 16
  • 81
  • 103