How to access frame (not iframe) contents from jQuery

后端 未结 5 1612
礼貌的吻别
礼貌的吻别 2020-12-09 08:21

I have 2 frames in one page like this (home.html)


        

        
5条回答
  •  误落风尘
    2020-12-09 09:00

    https://jamesmccaffrey.wordpress.com/2009/07/30/cross-frame-access-with-jquery/

        $(document).ready(function(){
         $("#Button1").click(function(){
          $(parent.rightFrame.document).contents().find(‘#TextBox1’).val(‘Hello from left frame!’);
         });
        });
    

    But I used :

        $.post("content_right.php",{id:id},function(data)
         $(parent.frames["content_right"].document.body).html(data) ;
        });
    

提交回复
热议问题