iframe 상위 페이지는 하위 페이지 메서드를 호출합니다.

subpage.html

<html>
<헤드>
<meta http-equiv="콘텐츠 유형" content="text/html; charset=utf-8">
<script src="http://lib.sinaapp.com/js/jquery/ 1.7.2/jquery.min.js" type="text/javascript"></script>   
<script type="text/javascript">
$(function(){ $('.selectAll').click(function( ){     $('input[name="check-item"]').prop('checked',this.checked); } )


 window.parent.parentHello();
})
 function sonHello() {             alert("이것은 son hello 함수입니다!");         }

</script>
</head>
<body>
<div>
<input type="checkbox" class="selectAll" name="selectAll">전 
<input type="checkbox" name="check-item" 온클릭= "모두();" />周一
<input type="checkbox" name="check-item" οnclick="all();" />周一
<input type="checkbox" name="check-item" οnclick="all();" />周一
<input type="checkbox" name="check-item" οnclick="all();" />周一
<input type="checkbox" name="check-item" οnclick="all();" />周一
</div>


</바디
> </html>

 

상위 페이지.html

 

<html>
<헤드>
<meta http-equiv="콘텐츠 유형" content="text/html; charset=utf-8">
<script src="http://lib.sinaapp.com/js/jquery/ 1.7.2/jquery.min.js" type="text/javascript"></script>   
<스크립트 type="text/javascript">

$(function(){   $('#아버지').click(function(){     myframe.window.sonHello();   })


})
 function parentHello() {             alert("이것은 부모 hello 함수입니다!");         }       // window.frames[0].sonHello();



</script>
</head>
<body>
<div>
<button id="아버지">点击</button>
<iframe src="checkall.html" name="myframe"></iframe>
</div>


</바디
> </html>

추천

출처blog.csdn.net/weixin_42835381/article/details/109330239