在index.html页面中有
<script type="text/javascript">
function test(){
alert('test() success!');
}
</script>
<body>
<a href="#" οnclick="frame1.window.childFunction();">调用</a>
<iframe name="frame1" src="test1.html"/>
<iframe name="frame2" src="test2.html"/>
</body>
在test1.html页面中有
<script type="text/javascript">
function childFunction(){
alert('test childFunction() success!');
}
</script>
<body>
<a href="#" οnclick="parent.test();">调用</a>
</body>
iframe调用子iframe的方法:parent.test()
子调用父iframe的方法:frame1.window.childFunction()