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

아이프레임 리사이징

페이지 정보

작성자 MintState 댓글 0건 조회 12,155회 작성일 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건 4 페이지
Javascript 목록
번호 제목 글쓴이 조회 날짜
118 MintState 11403 11-10
117 MintState 11420 11-17
116 MintState 11429 11-17
115 MintState 11443 11-17
114 MintState 11475 11-10
113 MintState 11533 11-17
112 MintState 11617 11-10
111 MintState 11676 11-17
110 MintState 11720 11-10
109 MintState 11799 10-31
108 MintState 11823 11-17
107 MintState 11844 11-17
106 MintState 11912 10-29
105 MintState 11964 11-10
104 MintState 11966 10-31
103 MintState 11971 11-07
102 MintState 11980 10-31
101 MintState 12012 11-17
100 MintState 12051 11-10
열람중 MintState 12156 11-10
게시물 검색
모바일 버전으로 보기
CopyRight ©2004 - 2024, YesYo.com MintState. ™