이미지에 맞게 창 띄우기
작성일 06-09-12 12:42
페이지 정보
작성자서방님 조회 158회 댓글 0건본문
<html>
<head>
<title>[마이엠] 애완동물-함께 사는 세상</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<script language='javascript'>
/**
* 이미지 크기에 맞춰서 창 가운데로 띄우기
*/
function WindowResize() {
var image = document.images[0]; // 이미지
var scroll = false; // 스크롤 여부
var sw,sh; // 해상도
var w,h; // 창크기
var l,t; // 창위치
// 해상도
sw = screen.width;
sh = screen.height - 30; // 작업표시줄 빼줌
// 창크기 - 이미지 크기 + 여백
w = image.width + 20;
h = image.height + 45;
// 창을 가운데로
l = (sw) ? (sw-w)/2 : 100;
t = (sh) ? (sh-h)/2 : 100;
// 해상도 보다 이미지가 크면 스크롤바 보여주고 창크기를 해상도에 맞춘다
if( w >= sw ) {
w = sw;
l = 0;
scroll = true;
}
if( h >= sh ) {
h = sh;
t = 0;
scroll = true;
}
// 가로로 긴 이미지 일겨우 세로 스크롤을 없애준다
if( w >= sw && h < sh ) {
h = h + 25;
}
// 세로로 긴 이미지 일 경우 가로 스크롤을 없애준다
if( w < sw && h >= sh ) {
w = w + 20;
}
// 스크롤 처리
if(scroll) {
document.getElementById("imageWin").scroll = "yes";
} else {
document.getElementById("imageWin").scroll = "no";
}
self.resizeTo(w, h); // 크기 조절
self.moveTo(l, t); // 가운데로
}
</script>
</head>
<body id="imageWin" bgcolor="#dddddd" text="#000000" leftmargin="5" topmargin="5" marginwidth="0" marginheight="0" onload="WindowResize()" onclick="self.close()" style="cursor: hand">
<div align="center">
<img name="image" id="image" src="<?=$_GET['image']?>" border='1' alt='클릭하시면 창이 닫힙니다!'>
</div>
</body>
</html>
댓글목록
등록된 댓글이 없습니다.