간편한 이미지 크게보기
작성일 07-08-07 16:43
페이지 정보
작성자서방님 조회 135회 댓글 0건본문
이미지 크게 보기를 간편하게 작성해 보자.
저는 프로젝트를 진행할때 필요한 JS 는 항상 가지고 다닙니다.
아직 php 나 asp 라이브러리화나 프레임웩 같은것도 없는데 - -;
js 는 가지고 챙겨서 다니느게 우숩네요 ㅎㅎ
소스는 아래와 같습니다.
간단하기 땜에 예제는 굳이 안하겠습니다.
사용법은
<img src="" onclick="this.src.popupView()">
이것만 하면 끝입니다.
팝업될 이미지가 1024 * 768 보다 크다면 팝업 가로세로 사이즈를 1024 * 768로 고정해줍니다.
본 스크립트의 개선사항이 있다면 저의 블러그에도 남겨주시길 부탁드립니다.
출처 : http://www.phpschool.com/gnuboard4/bbs/tb.php/tipntech/44057
<script>
String.prototype.popupView = function () {
var img_view = this;
var x = x + 20 ;
var y = y + 30 ;
htmlz = "<html><head><title>이미지크게보기</title><style>body{margin:0;cursor:hand;}</style></head><body scroll=auto onload='width1=document.all.Timage.width;if(width1>1024)width1=1024;height1=document.all.Timage.height;if(height1>768)height1=768;top.window.resizeTo(width1+30,height1+54);' onclick='top.window.close();'><img src='"+img_view+"' title='클릭하시면 닫힙니다.' name='Timage' id='Timage'></body></html>"
imagez = window.open('', "image", "width="+ 100 +", height="+ 100 +", top=0,left=0,scrollbars=auto,resizable=1,toolbar=0,menubar=0,location=0,directories=0,status=1");
imagez.document.open();
imagez.document.write(htmlz)
imagez.document.close();
}
</script>
댓글목록
등록된 댓글이 없습니다.