A页面内嵌一个Iframe 到B页面,B页面有个按钮,点击按钮后需调用A页面的Show方法
A页面:
<script>
function Show(){
document.getElementsByTagName("div")[0].innerText = 'Iframe'
}
</script>
<div></div>
<iframe src="B.html" width="100px" height="100px"></iframe>
B页面:
<button onclick="Action()">执行</button>
<script>
function Action(){
parent.window.iframe2Name.window.Show()
}
</script>
文章描述了一个A页面内嵌B页面的场景,其中B页面的按钮点击后需要触发A页面上的Show方法,实现父页面与子IFrame之间的通信。B页面通过`parent.window.iframe2Name.window.Show()`调用A页面的函数。
2042

被折叠的 条评论
为什么被折叠?



