frames["f2"].document.body.innerHTML
or
document.getElementById("f2").contentWindow.document.body.innertHTML;

解决方案 »

  1.   

    使用
    document.getElementById("f2").contentWindow.document.body.innertHTML获得的结果中,我一个个的试了,
    document.getElementById("f2").contentWindow.document
    都能得到一个object对象,但是
    document.getElementById("f2").contentWindow.document.body
    得到的就是null
    我不知道这是为什么
      

  2.   

    你用一个按钮来取应该就没有问题了。因为iframe加载页面需要一定的时间,即你的下的脚本去取内容的时候,iframe里的页面还没有加载或者没有加载完,当然就取不到数据了。