다른 도메인 iframe 자동 스크롤 작업중... 정보
다른 도메인 iframe 자동 스크롤 작업중...본문
web에서 다른 도메인 iframe 자동 스크롤 관련 소스를 보고 적용중입니다...
맨아래 소스대로 하긴 했는데...
문제는 list에서는 문제가 없는데 제가 적용해야 할 게시판의 view에서
<script language="JavaScript">
window.onload=function() {
resizeBoardImage(<?=(int)$board['bo_image_width']?>);
drawFont();
}
</script>
이미 위의 window.onload가 한번 쓰여서
아래 auto_size.html의
window.onload = onLoad; 부분과 충돌이 나고 있습니다.
이것저것 해보고 있는데 해결점을 못찾고 있습니다.
고수님들의 조언 부탁드립니다.
먼저 a라는 홈페이지에 auto_size.html을 만듭니다.
====================== auto_size.html - a.com =========================
<html>
<head>
<title>Resizing Page</title>
<script type="text/javascript">
function onLoad() {
var params = window.location.search.substring( 1 ).split( '&' );
var height;
for( var i = 0, l = params.length; i < l; ++i ) {
var parts = params[i].split( '=' );
switch( parts[0] ) {
case 'height':
height = parseInt( parts[1] );
break;
}
}
if( typeof( height ) == 'number' ) {
window.top.updateIFrame( height );
}
}
window.onload = onLoad;
</script>
</head>
<body>
<p>Resizing IFrame...</p>
</body>
</html>
=======================================================
그리고 a라는 홈페이지에서 링크할 문서에는 아래와 같이 삽입합니다.
======================= a.html - a.com ===================
<script type="text/javascript">
function updateIFrame( height ) {
var iframe = document.getElementById( 'myiframe' );
iframe.setAttribute( 'height', height );
}
</script>
http://b.com/b.html" scrolling=no frameborder=0 width="600" height="600">
이제 b라는 도메인의 b.html에는 아래와 같이 삽입합니다.
================== b.html - b.com============================
<style>
#inneriframe { position : absolute; top : 0px; left : 0px; visibility: hidden; }
</style>
<script type="text/javascript">
function rsize() {
var iframe = document.getElementById( 'inneriframe' );
var wrapper = document.getElementById( 'wrapper' );
var height = Math.max( document.body.offsetHeight, document.body.scrollHeight );
iframe.src = 'http://a.com/auto_size.html?height='+height; }
</script>
<body onload=rsize(); >
<div id=wrapper>
내용
</div>
<iframe id="inneriframe" width="10" height="10"></iframe>
</body>
맨아래 소스대로 하긴 했는데...
문제는 list에서는 문제가 없는데 제가 적용해야 할 게시판의 view에서
<script language="JavaScript">
window.onload=function() {
resizeBoardImage(<?=(int)$board['bo_image_width']?>);
drawFont();
}
</script>
이미 위의 window.onload가 한번 쓰여서
아래 auto_size.html의
window.onload = onLoad; 부분과 충돌이 나고 있습니다.
이것저것 해보고 있는데 해결점을 못찾고 있습니다.
고수님들의 조언 부탁드립니다.
먼저 a라는 홈페이지에 auto_size.html을 만듭니다.
====================== auto_size.html - a.com =========================
<html>
<head>
<title>Resizing Page</title>
<script type="text/javascript">
function onLoad() {
var params = window.location.search.substring( 1 ).split( '&' );
var height;
for( var i = 0, l = params.length; i < l; ++i ) {
var parts = params[i].split( '=' );
switch( parts[0] ) {
case 'height':
height = parseInt( parts[1] );
break;
}
}
if( typeof( height ) == 'number' ) {
window.top.updateIFrame( height );
}
}
window.onload = onLoad;
</script>
</head>
<body>
<p>Resizing IFrame...</p>
</body>
</html>
=======================================================
그리고 a라는 홈페이지에서 링크할 문서에는 아래와 같이 삽입합니다.
======================= a.html - a.com ===================
<script type="text/javascript">
function updateIFrame( height ) {
var iframe = document.getElementById( 'myiframe' );
iframe.setAttribute( 'height', height );
}
</script>
http://b.com/b.html" scrolling=no frameborder=0 width="600" height="600">
이제 b라는 도메인의 b.html에는 아래와 같이 삽입합니다.
================== b.html - b.com============================
<style>
#inneriframe { position : absolute; top : 0px; left : 0px; visibility: hidden; }
</style>
<script type="text/javascript">
function rsize() {
var iframe = document.getElementById( 'inneriframe' );
var wrapper = document.getElementById( 'wrapper' );
var height = Math.max( document.body.offsetHeight, document.body.scrollHeight );
iframe.src = 'http://a.com/auto_size.html?height='+height; }
</script>
<body onload=rsize(); >
<div id=wrapper>
내용
</div>
<iframe id="inneriframe" width="10" height="10"></iframe>
</body>
댓글 전체
function resize() {
resizeBoardImage(<?=(int)$board['bo_image_width']?>);
drawFont();
}
resize();
이런식으로 불러주시면 온로드랑 충돌 안날거예요
resizeBoardImage(<?=(int)$board['bo_image_width']?>);
drawFont();
}
resize();
이런식으로 불러주시면 온로드랑 충돌 안날거예요
미운오리쥬님 감사합니다...^ ^
그런데 주신 소스는 view페이지의 아래 부분을 수정하시라는 건지요?
<script language="JavaScript">
window.onload=function() {
resizeBoardImage(<?=(int)$board['bo_image_width']?>);
drawFont();
}
</script>
만약 맞다면 위식대로 고치면 실제 view페이지에서 사진 보기와 drawFont가 안 먹게 되더군요...
그런데 주신 소스는 view페이지의 아래 부분을 수정하시라는 건지요?
<script language="JavaScript">
window.onload=function() {
resizeBoardImage(<?=(int)$board['bo_image_width']?>);
drawFont();
}
</script>
만약 맞다면 위식대로 고치면 실제 view페이지에서 사진 보기와 drawFont가 안 먹게 되더군요...
아 이부분은 해결했습니다...
window.onload=function() {
resizeBoardImage(<?=(int)$board['bo_image_width']?>);
drawFont();
}
이부분에서 rsize를 한번 더 시켜 주니까 해결돼네요...^ ^
그런데 다른 문제가...ㅜ_ㅜ
window.onload=function() {
resizeBoardImage(<?=(int)$board['bo_image_width']?>);
drawFont();
}
이부분에서 rsize를 한번 더 시켜 주니까 해결돼네요...^ ^
그런데 다른 문제가...ㅜ_ㅜ