首页 > 代码库 > IFRAME练习 各种调用

IFRAME练习 各种调用

parent.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=http://www.mamicode.com/"调用child.html中的函数say()" onclick="callChild()"> <iframe name="myFrame" src=http://www.mamicode.com/"child.html"></iframe> </body> </html>

child.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=http://www.mamicode.com/"调用parent.html中的say()函数" onclick="callParent()"> 
</body> 
</html> 

 

IFRAME练习 各种调用