• iframe父子窗口间js方法调用


    父窗口调用iframe子窗口方法

    <iframe name="myFrame" src="child.html"></iframe>
    myFrame.window.functionName();

    iframe子窗口调用父窗口方法

    parent.functionName();

    父窗口页面

     <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>  


     

    子窗口页面

    <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>


     

    一起学习GIS及其二次开发,一起进步!
  • 相关阅读:
    Codeforces Round #239(Div. 2) 做后扯淡玩
    hdu 3507 Print Article
    prufer序列
    POJ 2778 DNA Sequence
    Codeforces Round #237 (Div. 2)
    poj3352
    图论知识
    POJ 2186
    Codeforces Round #236 (Div. 2)
    POJ 2823 Sliding Window
  • 原文地址:https://www.cnblogs.com/tuncaysanli/p/1433112.html
Copyright © 2020-2023  润新知