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="調用child.html中的函數say()" onclick="callChild()"> <iframe name="myFrame" src="child.html"></iframe> </body> </html>

child.htmljavascript

<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()函數" onclick="callParent()"> 
</body> 
</html> 
相關文章
相關標籤/搜索