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>