<iframe id="ifa"....   onload="this.height=ifa.document.body.scrollHeight"></iframe>这样写谷歌,ie完全兼容,,但是火狐报错ifa.document.body 未定义,,怎么办,急

解决方案 »

  1.   

    var frm = document.getElementById("ifa");   
    var subWeb=document.frames ? document.frames[iframe].document:frm.contentDocument;   
      if(frm != null && subWeb != null){
        frm.height = subWeb.body.scrollHeight;}
      

  2.   

    document.getElementById("ifa").body 
      

  3.   

    var frm = document.getElementById("ifa");   
    var subWeb=document.frames ? document.frames[iframe].document:frm.contentDocument;   
      if(frm != null && subWeb != null){
       frm.height = subWeb.body.scrollHeight;}document.getElementById("ifa").body