<HTML>
<head>
<script language='JavaScript' type='text/javascript'>
 function resizeFrame(iframeObj){
  var innerBody = iframeObj.contentWindow.document.body;
  oldEvent = innerBody.onclick;
  innerBody.onclick = function(){ resizeFrame(iframeObj, 1);oldEvent; };
  var innerHeight = innerBody.scrollHeight + (innerBody.offsetHeight - innerBody.clientHeight);
  iframeObj.style.height = innerHeight;
  var innerWidth = innerBody.scrollWidth + (innerBody.offsetWidth - innerBody.clientWidth);
  iframeObj.style.width = innerWidth;    
  if( !arguments[1] )        /* 특정 이벤트로 인한 호출시 스크롤을 그냥 둔다. */
    this.scrollTo(1,1);
 }
</script>
</head>
<body>
<h4>iframe 내 페이지 높이에 맞게 자동 조절하기
</h4>
<iframe name="wsos" id="wsos" src="/webdevdoc/index.php" style="width:100%"
 frameborder="0" framespacing="0" scrolling="no" onLoad="resizeFrame(this);"></iframe>

</body>
</html>

출처 : http://www.ihelpers.co.kr/programming/tipntech.php?CMD=view&IDX=516&source=overture

+ Recent posts