document.getElementById("myFrame").window.say看看行么

解决方案 »

  1.   

    document.getElementById("myFrame").window.say这种方法也行不通
      

  2.   

    document.getElementById("myFrame").contentWindow.say()
      

  3.   


    $(window.frames["myFrame"].document).say()
      

  4.   

    indow.frames["myFrame"].say();在chrome下肯定可以。昨天才用到的。
      

  5.   

    可以的,你肯定是页面  <iframe id="myFrame" name="myFrame" src="child.html"></iframe>  中iframe(child.html页面)还没加载进来,所以say方法是未定义的.改成一下试试:<html> 
    <body> 
    <iframe id="myFrame" name="myFrame" src="child.html"></iframe> 
    <script type='text/javascript'>
    myFrame.onload=function(){
    this.say();
    }
    </script>
    </body>
     </html>