b

iframe 의 크기를 자동으로 지정

bbking
· 2005-07-08 (금) 10:52:51 · 3184 · 1
<!doctype html public "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Sample Script </title>
<meta name="Generator" content="EditPlus">


<!-- [1단계] 아래의 코드를 <head> 와 </head> 사이에 붙여 넣으세요 -->


<script type="text/javascript">

var iframeids=["myframe"] // iframe 에 사용할 ID 를 지정 해 주세요

var iframehide="yes"

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent)
currentfr.attachEvent("onload", readjustIframe)
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

if (window.addEventListener)
window.addEventListener("load", resizeCaller, false)
else if (window.attachEvent)
window.attachEvent("onload", resizeCaller)
else
window.onload=resizeCaller

</script>


<!----------------- 여기까지 ----------------->

</head>

<body>

<!-- [2단계] 아래의 방법으로 iframe 태그를 넣으세요 -->

<iframe id="myframe" src="http://www.naver.com" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" vspace="0" hspace="0" style="overflow:visible; width:100%; display:none"></iframe>

<!-- 여기에서 주의할 점은 스크립트의 맨 처음에 지정한 iframe 의 아이디를 반드시 사용해야 한다는 점입니다 --->

<!----------------- 여기까지 ----------------->

<p>
위의 페이지는 iframe 태그에 의해 불려진 페이지의 전체 입니다<br>
이처럼 이 스크립트를 사용하면 불려질 문서의 길이가 자동으로 체크되어 그 길이만큼 iframe 이 보여집니다

</body>
</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:16:08 PHP & HTML에서 이동 됨]</div>

댓글 1개

써먹어야될곳이 생각났네요
감사합니다
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,187건
+
제목 글쓴이 날짜 조회
05-03-13 조회 2,850
05-03-13 조회 2,650
05-03-13 조회 2,690
05-03-13 조회 3,292
05-03-13 조회 2,505
05-03-13 조회 2,423
05-03-13 조회 2,557
05-03-13 조회 3,681
05-03-13 조회 2,713
05-03-13 조회 2,783
05-03-13 조회 2,915
05-03-13 조회 2,729
05-03-13 조회 2,826
05-03-13 조회 2,652
05-03-13 조회 3,022
05-03-13 조회 2,769
05-03-13 조회 3,525
05-03-13 조회 3,247
05-03-13 조회 3,519
05-03-13 조회 2,469
05-03-13 조회 2,545
05-03-13 조회 3,111
05-03-13 조회 2,600
05-03-13 조회 4,679
05-03-13 조회 3,606
05-03-13 조회 3,060
05-03-13 조회 3,742
05-03-13 조회 2,729
05-03-13 조회 2,599
05-03-13 조회 3,539
05-03-13 조회 2,463
05-03-13 조회 2,683
05-03-13 조회 4,193
05-03-13 조회 2,839
05-03-13 조회 2,541
05-03-13 조회 5,854
05-03-13 조회 5,479
05-03-13 조회 4,397
05-03-13 조회 4,698
05-03-13 조회 7,957
05-03-13 조회 4,461
05-03-13 조회 3,537
05-03-13 조회 3,538
05-03-13 조회 8,079
05-03-13 조회 5,559
05-03-13 조회 2,823
05-03-13 조회 4,205
05-03-13 조회 2,901
05-03-13 조회 2,505
05-03-13 조회 3,257
05-03-13 조회 2,717
05-03-13 조회 2,381
05-03-13 조회 2,726
05-03-13 조회 3,908
05-03-13 조회 3,373
05-03-13 조회 2,669
05-03-13 조회 2,599
05-03-12 조회 4,932
05-03-12 조회 3,862
05-03-12 조회 4,559
05-03-12 조회 4,362
05-02-24 조회 4,711
05-02-24 조회 9,481
05-02-23 조회 3,484
05-02-04 조회 4,642
05-02-04 조회 4,110
05-02-04 조회 3,518
05-02-04 조회 3,579
05-02-04 조회 3,511
05-02-04 조회 3,780
04-12-27 조회 3,967
04-12-24 조회 6,252
04-12-22 조회 4,852
04-12-16 조회 5,907
04-12-13 조회 7,137
04-12-11 조회 8,254
04-12-09 조회 1.9만
04-12-08 조회 7,857
04-12-04 조회 3,841
04-12-04 조회 5,072
04-12-01 조회 3,415
04-12-01 조회 5,255
04-12-01 조회 3,854
04-11-30 조회 3,137
04-11-30 조회 3,348
04-11-30 조회 3,118
04-11-30 조회 3,477
04-11-30 조회 2,632
04-11-30 조회 2,478
04-11-30 조회 2,565
04-11-30 조회 3,046
04-11-30 조회 2,814
04-11-30 조회 3,297
04-11-30 조회 4,460
04-11-30 조회 2,518
04-11-30 조회 2,720
04-11-30 조회 4,121
04-11-29 조회 3,277
04-11-29 조회 4,122
04-11-29 조회 3,854