Javascript 如何从父级调用iframe中的func?
我想从父对象调用iframe中的func。 如果func在parent中,我可以像这样调用它:parent.func(); 但是我想调用iframe中的func,我想从父级调用它? js说我找不到func?我怎么称呼它 谢谢试一下Javascript 如何从父级调用iframe中的func?,javascript,html,iframe,Javascript,Html,Iframe,我想从父对象调用iframe中的func。 如果func在parent中,我可以像这样调用它:parent.func(); 但是我想调用iframe中的func,我想从父级调用它? js说我找不到func?我怎么称呼它 谢谢试一下 window.frames['childFrame'].func(); 或 你可以这样做 document.getElementById('frame').contentWindow.helloWorld() Ref:childFrame.contentWindow
window.frames['childFrame'].func();
或
你可以这样做
document.getElementById('frame').contentWindow.helloWorld()
Ref:
childFrame.contentWindow.func()
?对不起,问题已经存在,我删除它请删除您的答案我想删除我的问题
document.getElementById('childFrame').contentWindow.func();