사이트 내 전체검색
PHP
[php] 이미지 새창에 띄우고. 창크기 조정 스크롤
로빈아빠
https://cmd.kr/php/419 URL이 복사되었습니다.

본문

이미지 새창에 띄우고. 창크기 조정 스크롤 

//본문
<script> 
function big_img(img)
{                
        a_win = window.open("view_img.php?img=" + img,"popwin", "width=520 ,height=400,resizable=yes,scrollbars=no");
        a_win.focus();
}
</script>

<a href='javascript:big_img("http://user.chol.com/~story1/jioworld/U.jpg")'><img src=http://user.chol.com/~story1/jioworld/U.jpg width=200 border=0></a>


//새창띄우기후 조정 소스  view_img.php
<html>
<head>
<title>YESYO.COM ::이미지 보기::</title>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
</head>

<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad="fitWindowSize();">

<SCRIPT LANGUAGE="JavaScript">

var ie = 1;
var windowX, windowY;
var bLargeImage = 0;
var x,y;

var InitX = 500;

// 이미지가 새창에 맞게 조절되는 부분
function fitWindowSize()   
{
if( ie )
{
window.resizeTo( InitX, InitX );
width  = InitX - (document.body.clientWidth  - document.images[0].width);
height = InitX - (document.body.clientHeight - document.images[0].height);
windowX = (window.screen.width-width)/2;
windowY = (window.screen.height-height)/2;
if( width > screen.width-50 )
{
width = screen.width-50;
windowX = 20;
bLargeImage = 1;
}
if( height > screen.height-80 )
{
height = screen.height-80;
windowY = 20;
bLargeImage = 1;
}
window.moveTo( windowX, windowY );
window.resizeTo( width, height+4 );
}
else
{
window.innerWidth  = document.layers[0].document.images[0].width;
window.innerHeight = document.layers[0].document.images[0].height;
}
}

// 휠마우스 효과
function move() {
if(bLargeImage){  window.scroll(window.event.clientX - 50,window.event.clientY -50);
}
}

// 오른쪽 왼쪽 마우스 클릭시 창닫는 부분
function click() { 
if ((event.button==1) || (event.button==2) || (event.button==3)) {
top.self.close();
}
}
document.onmousedown=click
</script>
<Table width="100%" cellpadding="0" border="0" cellspacing="0">
<tr>
<td valign="middle" align="center">
<img src="<?=$img?>" border="0"  ONMOUSEMOVE="move();">
</td>
</tr>
</table>
</body>
</html>

댓글목록

등록된 댓글이 없습니다.

PHP
871 (11/18P)

Search

Copyright © Cmd 명령어 18.191.168.83