简体   繁体   中英

Call main page function from iFrame?

Yes, I have seen this question, but I am still finding myself confused: How to Call JavaScript From Main Window

I want to call a function that toggles an object with jQuery on the parent frame from an iframe. How exactly would something be done?

window.parent.[...?]

In main window:

function toggleMe() {
    $('#myid').toggle();
}

In child frame:

window.parent.toggleMe();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM