父级:parent.html
调用孩子方法:fuji.window.functionName();
<!doctype html>
<html>
<head>
<script type="text/javascript">
function say() {
alert("parent.html------>I'm at parent.html");
}
function callChild() {
//document.frames("myFrame").f1();
myFrame.window.say();
}
</script>
</head>
<body>
<input type=button value="调用child.html中的函数say()" οnclick="callChild()">
<iframe name="fuji" src="child.html"></iframe>
</body>
</html>
父级:child.html
调用孩子方法:parent.functionName();
<!doctype html>
<html>
<head>
<script type="text/javascript">
function say() {
alert("child.html--->I'm at child.html");
}
function callParent() {
parent.say();
}
</script>
</head>
<body>
<input type=button value="调用parent.html中的say()函数" οnclick="callParent()">
</body>
</html>
转载于:https://blog.51cto.com/12435773/1954360