子页面.html
<html>
<head>
<meta http-equiv="Content-Type" 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("this is son hello function!");
}
</script>
</head>
<body>
<div>
<input type="checkbox" class="selectAll" name="selectAll">全选
<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();" />周一
<input type="checkbox" name="check-item" οnclick="all();" />周一
</div>
</body>
</html>
父页面.html
<html>
<head>
<meta http-equiv="Content-Type" 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(){
$('#father').click(function(){
myframe.window.sonHello();
})
})
function parentHello() {
alert("this is parent hello function!");
}
// window.frames[0].sonHello();
</script>
</head>
<body>
<div>
<button id="father">点击</button>
<iframe src="checkall.html" name="myframe"></iframe>
</div>
</body>
</html>