<html>
<head>
<meta charset="utf-8">
<script type="text/javascript">
function hello(){
alert("father.html");
}
function callChild()
{
//myFrame是iframe的name
//myFrame.window.functionName();
myFrame.window.hello(); //父窗口掉子窗口hello方法
}
</script>
</head>
<body>
<input type="button" value="调用子窗口hello方法" οnclick="callChild()">
<iframe name="myFrame" src="child.html"></iframe>
</body>
</html>
========================================================================
<html>
<head>
<script type="text/javascript">
function hello()
{
alert("child.html");
}
function callParent(){
// parent.functionName();
parent.hello(); //子窗口掉父窗口hello方法
}
</script>
</head>
<body>
<input type="button" value="调用父窗口hello方法"οnclick="callParent()">
</body>
</html>
转自:http://lichaobao.iteye.com/blog/2163088
<head>
<meta charset="utf-8">
<script type="text/javascript">
function hello(){
alert("father.html");
}
function callChild()
{
//myFrame是iframe的name
//myFrame.window.functionName();
myFrame.window.hello(); //父窗口掉子窗口hello方法
}
</script>
</head>
<body>
<input type="button" value="调用子窗口hello方法" οnclick="callChild()">
<iframe name="myFrame" src="child.html"></iframe>
</body>
</html>
========================================================================
<html>
<head>
<script type="text/javascript">
function hello()
{
alert("child.html");
}
function callParent(){
// parent.functionName();
parent.hello(); //子窗口掉父窗口hello方法
}
</script>
</head>
<body>
<input type="button" value="调用父窗口hello方法"οnclick="callParent()">
</body>
</html>
转自:http://lichaobao.iteye.com/blog/2163088