b

iframe 의 크기를 자동으로 지정

bbking
· 2005-07-08 (금) 10:52:51 · 3156 · 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,188건
+
제목 글쓴이 날짜 조회
10-09-25 조회 2,755
10-09-19 조회 2,792
10-09-15 조회 2,805
10-09-15 조회 4,209
10-09-15 조회 3,442
10-09-15 조회 2,537
10-09-07 조회 3,656
10-08-27 조회 4,111
10-06-11 조회 4,293
10-05-31 조회 2,540
10-02-27 조회 5,053
10-02-09 조회 3,797
09-10-10 조회 7,389
09-03-19 조회 3,244
09-02-09 조회 3,516
09-02-09 조회 4,567
08-11-01 조회 2,950
08-09-29 조회 4,602
08-09-26 조회 3,537
08-09-26 조회 3,610
08-09-26 조회 2,746
08-09-26 조회 3,791
08-09-26 조회 3,517
08-09-26 조회 4,288
08-09-18 조회 3,632
08-09-09 조회 3,267
08-08-28 조회 2,807
08-07-06 조회 3,577
08-05-21 조회 4,734
08-05-13 조회 4,581
08-04-17 조회 4,950
08-02-19 조회 3,566
08-01-18 조회 3,894
08-01-10 조회 3,856
07-10-22 조회 3,691
07-10-09 조회 4,361
07-10-03 조회 3,566
07-07-06 조회 4,240
07-07-06 조회 4,455
07-07-06 조회 4,071
07-06-28 조회 3,602
07-06-05 조회 3,615
07-06-05 조회 4,162
07-05-30 조회 3,328
07-05-02 조회 3,708
07-04-15 조회 5,191
07-04-11 조회 3,669
07-04-05 조회 3,974
07-03-31 조회 3,184
07-03-31 조회 4,157
07-03-30 조회 3,771
07-03-24 조회 4,029
07-03-22 조회 3,693
07-03-12 조회 4,447
07-02-16 조회 3,315
07-02-14 조회 5,198
07-02-10 조회 4,040
07-02-09 조회 4,419
07-01-19 조회 4,089
07-01-16 조회 5,024
06-12-16 조회 5,889
06-11-30 조회 3,638
06-11-25 조회 3,755
06-10-15 조회 5,107
06-09-26 조회 5,343
06-09-26 조회 5,462
06-09-22 조회 4,322
06-09-21 조회 3,570
06-09-21 조회 3,673
06-09-02 조회 3,511
06-08-08 조회 5,150
06-07-20 조회 3,777
06-07-17 조회 3,400
06-07-13 조회 4,221
06-07-11 조회 3,515
06-07-11 조회 3,516
06-07-11 조회 3,877
06-06-29 조회 6,117
06-06-19 조회 6,491
06-06-02 조회 3,553
06-05-24 조회 5,028
06-05-14 조회 7,818
06-05-08 조회 3,937
06-02-02 조회 5,488
05-12-16 조회 4,565
05-12-05 조회 5,196
05-06-28 조회 4,155
05-04-11 조회 4,109
05-04-11 조회 4,287
05-04-11 조회 3,349
05-03-13 조회 3,261
05-03-12 조회 4,322
04-12-08 조회 7,815
04-12-01 조회 5,222
04-11-28 조회 3,405
04-11-28 조회 3,241
04-08-05 조회 5,660
04-08-05 조회 5,007
04-08-05 조회 5,621