YesYo.com MintState Forums
뒤로    YesYo.com MintState BBS > Tech > Javascript
검색
멤버이름    오토
비밀번호 
 

아이프레임 리사이징

페이지 정보

작성자 MintState 댓글 0건 조회 12,076회 작성일 08-11-10 11:51

본문

아이프레임 리사이징

본페이지
<div id="a_iframe" style="width:645px; table-layout:fixed;">
	<iframe id="iframeID" name="iframeID" src="Iframe.html" width="100%" height="0" frameborder="0" scrolling="no"></iframe>
</div>


해당 Iframe 페이지
<script language="JavaScript">
function autoResize() {
	try {
		resizeTo(document.body.scrollWidth, document.body.scrollHeight);
	}
	catch(e) {
		window.setTimeout("autoResize()", 1000);
	}
}
</script>

<script language="JavaScript" for="window" event="onload">
window.setTimeout("autoResize()", 500);
window.setTimeout("autoResize()", 1000);
</script>



파이어폭스(firefox) 적용 소스
<SCRIPT LANGUAGE="JavaScript">
function resizeFrame() {
var min_h = 600;
	var oIFrame = document.getElementById("content_");
        try {
		var oDoc = oIFrame.contentDocument || oIFrame.contentWindow.document;
		if (/MSIE/.test(navigator.userAgent)) {
			var frmHeight = oDoc.body.scrollHeight;
		} else {
			var s = oDoc.body.appendChild(document.createElement('DIV'))
			s.style.clear = 'both';
			var frmHeight = s.offsetTop;
			s.parentNode.removeChild(s);
		}
		if (frmHeight < min_h) frmHeight = min_h;
		oIFrame.style.height = frmHeight;
	} catch (e) { }
}
</script>
--------------------------------------------------------------------
<iframe id="content_" name="content_" src="" width="100%" height="600" frameborder="0" scrolling="auto" onload="resizeFrame()"></iframe>



====================================================
네이트 클럽에서 사용하는 소스

<SCRIPT LANGUAGE="JavaScript">
// iframe resize Function
function reSizeFrm()
{
        var objTotal = document.body;
	var objBody	    =	ifrm.document.body;
	var objFrame	=	document.all["ifrm"];

	if ( objBody == null )
		setTimeout("reSizeFrm();",1000);
	else
	 	objFrame.style.height = objBody.scrollHeight + (objBody.offsetHeight - objBody.clientHeight)+182;
	objFrame.style.width = '100%';
}
// iframe initialize Function
function frame_init()
{
	parent.reSizeFrm();
	parent.scrollTo(1,1);
}

setTimeout("parent.resizeFrame();",500);
</script>

댓글목록

등록된 댓글이 없습니다.

Total 178건 5 페이지
Javascript 목록
번호 제목 글쓴이 조회 날짜
98 MintState 12485 11-10
97 MintState 12367 11-17
96 MintState 12365 11-10
95 MintState 12328 11-17
94 MintState 12328 11-17
93 MintState 12311 11-17
92 MintState 12265 10-31
91 MintState 12265 11-07
90 MintState 12254 11-07
89 MintState 12253 11-17
88 MintState 12250 11-17
87 MintState 12176 10-29
86 MintState 12169 10-29
85 MintState 12136 11-10
84 MintState 12136 11-17
83 MintState 12109 11-07
82 MintState 12100 11-17
81 MintState 12096 10-29
열람중 MintState 12077 11-10
79 MintState 11939 11-10
게시물 검색
모바일 버전으로 보기
CopyRight ©2004 - 2024, YesYo.com MintState. ™