How to access frame (not iframe) contents from jQuery

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

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


        

        
5条回答
  •  自闭症患者
    2020-12-09 08:52

    You could grab the Frame and div you are wanting to manipulate and pass it into a variable.

    var statusText = top.frames["treeStatus"].document.getElementById('statusText');
    

    Then you can do anything you want to it through jQuery.

    $(statusText).whatever();
    

    Though sometimes you just can't get around having to use frames, keep in mind that the tag is obsoleted in HTML5. If you ever plan on moving up to HTML5, you'll have to use iFrames.

提交回复
热议问题