iframe la página principal llama al método de la página secundaria

subpagina.html

<html>
<head>
<meta http-equiv="Tipo de contenido" 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="elemento de control"]').prop('marcado',este.marcado); } )


 ventana.parent.parentHello();
})
 function hijoHola() {             alert("¡Esta es la función hijo hola!");         }

</script>
</head>
<body>
<div>
<input type="checkbox" class="selectAll" name="selectAll">全选 
<input type="checkbox" name="check-item" onclick= "todo();" />周一
<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>


</cuerpo>
</html>

 

página principal.html

 

<html>
<head>
<meta http-equiv="Tipo de contenido" 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">

$(función(){   $('#padre').click(función(){     myframe.window.sonHello();   })


})
 function parentHello() {             alert("¡Esta es la función padre hola!");         }       // ventana.marcos[0].hijoHola();



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


</cuerpo>
</html>

Supongo que te gusta

Origin blog.csdn.net/weixin_42835381/article/details/109330239
Recomendado
Clasificación