iframe 자동길이조절 정보
iframe 자동길이조절본문
이것저것 아무리 해봐도 안되더만,,, 이건 되네요,,
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>
<!-- 게시판 끝-->
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>
<!-- 게시판 끝-->
추천
3
3
댓글 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이벤트에 걸어줬여요
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이벤트에 걸어줬여요
저도 적용해 봐야겠네요