'아이프레임'에 해당되는 글 1건

  1. 2008.09.09 아이프레임 사이즈 자동변환
2008. 9. 9. 00:00

방법...1..

<script Language='javascript'>
function reSize() {
        try{
        var objBody = ifrm.document.body;
        var objFrame = document.all["ifrm"];
        ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
       
        if (ifrmHeight > 300) {
                objFrame.style.height = ifrmHeight
        }else{
                objFrame.style.height = 300;
        }
        objFrame.style.width = '100%'
        }catch(e){}
}
function init_iframe() {
        reSize();
        setTimeout('init_iframe()',200)
}
init_iframe();
</script><iframe id='ifrm' src="보여질페이지주소" width="가로크기" height="세로크기" frameborder=0 marginheight=0 marginwidth=0></iframe>


방법2.

<script>
function doResize()
{
container.height = myframe.document.body.scrollHeight;
container.width = myframe.document.body.scrollWidth;
}
</script>
<table border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td id="container"><iframe src="your_file.html" name="myframe" width="100%" height="100%" marginwidth="0" marginheight="0" frameborder="no" onload="doResize()"></iframe></td>
  </tr>
</table>





Posted by ToTb