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

1
  • You are going to have to post some code. Commented Dec 3, 2012 at 15:00

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.