从父页面调用iframe中的JavaScript代码基本上,我有一个iframe嵌入到页面中,而iframe有一些JavaScript我需要从父页面调用的例程。相反的情况很简单,因为您只需要调用parent.functionName()但不幸的是,我需要的正好相反。请注意,我的问题不是更改源。URL.的.iframe中定义的函数。iframe.
4 回答

牛魔王的故事
TA贡献1830条经验 获得超3个赞
targetFunction()
:
document.getElementById('targetFrame').contentWindow.targetFunction();
window.frames
document.getElementById
.
// this option does not work in most of latest versions of chrome and Firefoxwindow.frames[0].frameElement.contentWindow.targetFunction();

慕妹3146593
TA贡献1820条经验 获得超9个赞
iframe
iframe
http://
https://
.
父页面和iframe页面来自不同的域。 他们使用不同的协议,一种是在http:/上,另一种是在https://.上
iframe
添加回答
举报
0/150
提交
取消