테스트 사이트 - 개발 중인 베타 버전입니다

iframe 자동길이조절

· 12년 전 · 6405 · 4
이것저것 아무리 해봐도 안되더만,,, 이건 되네요,,

ifrmHeight을 ifrmHeight + "px"로 바꾸니,,, 되네요,,

ie8, ie9, ie10, safari에서 다 잘 됩니다. 다른데서는 테스트 안해봐서,,ㅠㅠ

해보신 분들 댓글 달아주삼,,



<!--- 아이프레임자동으로늘어나는자바스크립 --->
<script language="JavaScript">
function reSize() {
try {
var objBody = auto_iframe.document.body;
var objFrame = document.all["auto_iframe"];
ifrmHeight = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight);
objFrame.style.height = ifrmHeight + "px";
}
catch(e) {}
}

function init_iframe() {
reSize();
setTimeout('init_iframe()',1)
}

init_iframe();
</script>
<!--- 아이프레임자동으로늘어나는자바스크립 끝--->


<!-- 게시판 아이프레임-->
<iframe src="게시판주소" frameborder="0" width="100%" allowtransparency="true"
name="auto_iframe" id="auto_iframe" marginwidth="0" marginheight="0" scrolling="No"></iframe>
<!-- 게시판 끝-->

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

댓글 4개

아 테스트 해 봐야 겠네요..ㅎㅎ
정보 감사드립니다
저는...
function fnc_ifrm_height(obj){
if(obj.contentDocument){
obj.height = obj.contentDocument.body.offsetHeight + 40;
} else {
obj.height = obj.contentWindow.document.body.scrollHeight+ 40;
}
}
<iframe src="./list.php" width="600" onLoad="fnc_ifrm_height(this)" frameborder="0">
d일케 onload이벤트에 걸어줬여요
저도 적용해 봐야겠네요

게시글 목록

번호 제목
32610
32609
32604
32601
32587
32583
32574
32571
32558
32557
32554
32550
32532
32516
32512
32507
32490
32488
32464
32459