父窗口调用iframe子窗口方法
1 | < iframe name = "myFrame" src = "child.html" ></ iframe > |
2 | myFrame.window.functionName(); |
iframe子窗口调用父窗口方法
父窗口页面
03 | < script type = "text/javascript" > |
06 | alert("parent.html------>I'm at parent.html"); |
11 | //document.frames("myFrame").f1(); |
18 | < input type = button value = "调用child.html中的函数say()" onclick = "callChild()" > |
19 | < iframe name = "myFrame" src = "child.html" ></ iframe > |
子窗口页面
03 | < script type = "text/javascript" > |
07 | alert("child.html--->I'm at child.html"); |
10 | function callParent() { |
16 | < input type = button value = "调用parent.html中的say()函数" onclick = "callParent()" > |
转载于:https://www.cnblogs.com/ternastone/archive/2010/12/03/1895433.html