iframe auto height

<script type="text/javascript">
   function SetCwinHeight(iframeObj){
    if (document.getElementById){
     if (iframeObj && !window.opera){
      if (iframeObj.contentDocument && iframeObj.contentDocument.body.offsetHeight){
       iframeObj.height = iframeObj.contentDocument.body.offsetHeight;
      }else if(document.frames[iframeObj.name].document && document.frames[iframeObj.name].document.body.scrollHeight){
       iframeObj.height = document.frames[iframeObj.name].document.body.scrollHeight;
      }
     }
    }
   }
   </script>
   <iframe width="100%" name="frameContent" onload="SetCwinHeight(this)" frameborder="0" src="*"></iframe>

你可能感兴趣的:(html,Opera)