日期:2014-05-17 浏览次数:20900 次
<script language="javascript" type="text/javascript"> 
<!--ifram框架自适应高度调整函数 -->
function dyniframesize(down) { 
var pTar = null; 
if (document.getElementById){ 
pTar = document.getElementById(down); 
} 
else{ 
eval('pTar = ' + down + ';'); 
} 
if (pTar && !window.opera){ 
//begin resizing iframe 
pTar.style.display="block" 
if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){ 
//ns6 syntax 
pTar.height = pTar.contentDocument.body.offsetHeight +20; 
pTar.width = pTar.contentDocument.body.scrollWidth+20; 
} 
else if (pTar.Document && pTar.Document.body.scrollHeight){ 
//ie5+ syntax 
pTar.height = pTar.Document.body.scrollHeight; 
pTar.width = pTar.Document.body.scrollWidth; 
} 
} 
} 
</script>
<script language="javascript" type="text/javascript"> 
<!--ifram框架自适应高度调整函数 -->
function dyniframesize(o) { 
  if(!o) o=document.getElementById(o);
  if(!o){alert('神马状况,怎么都不对?');  return;}
  //begin resizing iframe 
  o.style.display="block" ;
  doc=o.contentDocument||o.contentWindow.document
  if (o.contentDocument && o.contentDocument.body.offsetHeight){ 
    o.style.height = o.contentDocument.body.offsetHeight +20; 
    o.style.width = o.contentDocument.body.scrollWidth+20; 
  } 
  else if (o.Document && o.Document.body.scrollHeight){ 
    //ie5+ syntax 
    o.style.height = o.Document.body.scrollHeight; 
    o.style.width = o.Document.body.scrollWidth; 
  } 
} 
</script>
<iframe src="1.html" name="main_product" width="100%" height="250" marginheight="0" scrolling="No" frameborder="0" id="main" onload="javascript:dyniframesize(this)"></iframe>
------解决方案--------------------