답변 1개
채택된 답변
+20 포인트
9년 전
예를 들어 320x240 크기의 test.jpg 이미지를 새창으로 띄우고 클릭하면 닫히게 할려면
</p><p><img src="./images/test.jpg" onclick="image_window('./images/test.jpg','320','240');" style='cursor:hand;border:0;'></p><p> </p><p> </p><p><script></p><p> </p><p>function image_window(img,w,h)</p><p> {</p><p> var img = img;</p><p> var winl = (screen.width-w)/2; </p><p> var wint = (screen.height-h)/3; </p><p> </p><p> if (w >= screen.width) { </p><p> winl = 0; </p><p> h = (parseInt)(w * (h / w)); </p><p> } </p><p> </p><p> if (h >= screen.height) { </p><p> wint = 0; </p><p> w = (parseInt)(h * (w / h)); </p><p> } </p><p> </p><p> </p><p> var settings;</p><p> </p><p> </p><p> settings ='width='+w+','; </p><p> settings +='height='+h+','; </p><p> settings +='top='+wint+','; </p><p> settings +='left='+winl+','; </p><p> settings +='scrollbars=no,'; </p><p> settings +='resizable=yes,'; </p><p> settings +='status=no'; </p><p> </p><p> </p><p> win=window.open("","image_window",settings); </p><p> win.document.open(); </p><p> win.document.write ("<html><head> \n<meta http-equiv='imagetoolbar' CONTENT='no'> \n<meta http-equiv='content-type' content='text/html; charset=euc-kr'>\n"); </p><p> var size = "이미지 사이즈 : "+w+" x "+h;</p><p> win.document.write ("<title>"+size+"</title> \n"); </p><p> </p><p> var click = "onclick='window.close();' style='cursor:pointer' title=' "+size+" \n\n 클릭하면 닫혀요. '"; </p><p> win.document.write ("<style>.dragme{position:relative;}</style> \n"); </p><p> win.document.write ("</head> \n\n"); </p><p> win.document.write ("<body leftmargin=0 topmargin=0 bgcolor=#dddddd style='cursor:arrow;'> \n"); </p><p> win.document.write ("<table width=100% height=100% cellpadding=0 cellspacing=0><tr><td align=center valign=middle><img src='"+img+"' width='"+w+"' height='"+h+"' border=0 class='dragme' "+click+"></td></tr></table>");</p><p> win.document.write ("</body></html>"); </p><p> win.document.close(); </p><p> </p><p> }</p><p></script></p><p>
로그인 후 평가할 수 있습니다
답변에 대한 댓글 1개
�
민쯩먼저깔게요
9년 전
감사합니다.~ 잘되네요
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인