2009년 02월 11일
이미지 팝업띄우기
이미지 팝업 띄울 때, 이미지 사이즈에 맞게 창크기 리사이즈
그림 클릭 했을시 자동으로 창 종료
<script language="JavaScript">
function popImg(img){
var Popimg;
Popimg=window.open("","","width=100, height=100, resizable=yes");
Popimg.document.write("<html><head>");
Popimg.document.write("<title>::::: PIC :::::</title>");
Popimg.document.write("</title></head>");
Popimg.document.write("<script>");
Popimg.document.write("function resizeWin() {");
Popimg.document.write("var obj = document.getElementById('img');");
Popimg.document.write("var w = obj.width;");
Popimg.document.write("var h = obj.height;");
Popimg.document.write("window.resizeTo(w + 10, h + 27);");
Popimg.document.write("}");
Popimg.document.write("<\/script>");
Popimg.document.write("<body topmargin=0");
Popimg.document.write(" leftmargin=0");
Popimg.document.write(" onLoad='resizeWin();'>");
Popimg.document.write("<img src='" + img + "'");
Popimg.document.write(" onclick='self.close()'");
Popimg.document.write(" style=cursor:hand id='img'>");
Popimg.document.write("</body></html>");
Popimg.document.close();
}
</script>
<img src="/image/no_image.jpg" onclick="popImg(this.src);"/>
그림 클릭 했을시 자동으로 창 종료
<script language="JavaScript">
function popImg(img){
var Popimg;
Popimg=window.open("","","width=100, height=100, resizable=yes");
Popimg.document.write("<html><head>");
Popimg.document.write("<title>::::: PIC :::::</title>");
Popimg.document.write("</title></head>");
Popimg.document.write("<script>");
Popimg.document.write("function resizeWin() {");
Popimg.document.write("var obj = document.getElementById('img');");
Popimg.document.write("var w = obj.width;");
Popimg.document.write("var h = obj.height;");
Popimg.document.write("window.resizeTo(w + 10, h + 27);");
Popimg.document.write("}");
Popimg.document.write("<\/script>");
Popimg.document.write("<body topmargin=0");
Popimg.document.write(" leftmargin=0");
Popimg.document.write(" onLoad='resizeWin();'>");
Popimg.document.write("<img src='" + img + "'");
Popimg.document.write(" onclick='self.close()'");
Popimg.document.write(" style=cursor:hand id='img'>");
Popimg.document.write("</body></html>");
Popimg.document.close();
}
</script>
<img src="/image/no_image.jpg" onclick="popImg(this.src);"/>
# by ShiinaTsu | 2009/02/11 16:32 | Javascript | 트랙백 | 덧글(2)




