<script language="javascript">
function view(what) {
var imgwin = window.open("",'WIN','scrollbars=no,status=no,toolbar=no,resizable=1,Location=no,menu=no,width=10,height=10');
imgwin.focus();
imgwin.document.open();
imgwin.document.write("<html>\n");
imgwin.document.write("<head>\n");
imgwin.document.write("<title></title>\n");

imgwin.document.write("<sc"+"ript>\n");
imgwin.document.write("function resize() {\n");
imgwin.document.write("pic = document.il;\n");
//imgwin.document.write("alert(eval(pic).height);\n");
imgwin.document.write("if (eval(pic).height) { var name = navigator.appName\n");
imgwin.document.write("  if (name == 'Microsoft Internet Explorer') { myHeight = eval(pic).height + 20; myWidth = eval(pic).width + 12;\n");
imgwin.document.write("  } else { myHeight = eval(pic).height + 9; myWidth = eval(pic).width; }\n");
imgwin.document.write("  clearTimeout();\n");
imgwin.document.write("  var height = screen.height;\n");
imgwin.document.write("  var width = screen.width;\n");
imgwin.document.write("  var leftpos = width / 2 - myWidth / 2;\n");
imgwin.document.write("  var toppos = height / 2 - myHeight / 2; \n");
imgwin.document.write("  self.moveTo(leftpos, toppos);\n");
imgwin.document.write("  self.resizeTo(myWidth, myHeight);\n");
imgwin.document.write("}else setTimeOut(resize(), 100);}\n");
imgwin.document.write("</sc"+"ript>\n");

imgwin.document.write("</head>\n");
imgwin.document.write('<body topmargin="0" leftmargin="0" marginheight="0" marginwidth="0" bgcolor="#FFFFFF">\n');

imgwin.document.write("<img border=0 src="+what+" xwidth=100 xheight=9 name=il ='resize();'>\n");
imgwin.document.write("</body>\n");
imgwin.document.close();

}
</script>

아래소스를 <head>와</head>사이에 넣어줍니다.

<script language="JavaScript">
var imgObj = new Image();
function showImgWin(imgName) {
imgObj.src = imgName;
setTimeout("createImgWin(imgObj)", 100);
}
function createImgWin(imgObj) {
if (! imgObj.complete) {
setTimeout("createImgWin(imgObj)", 100);
return;
}
imageWin = window.open("", "imageWin",
"width=" + imgObj.width + ",height=" + imgObj.height);
imageWin.document.write("<html><body style='margin:0'>");
imageWin.document.write("<img src='" + imgObj.src + "'>");
imageWin.document.write("</body><html>");
imageWin.document.title = imgObj.src;
}
</script>

<body>와</body>사이에 넣어줍니다

<a href="javascript:showImgWin('이미지주소')">이미지 보기</a>

<a href="javascript:history.go(1)">
앞으로</a>


<a href="javascript:history.go(0)">
<a href="javascript:history.reload()">
새로고침</a>


<a href="javascript:history.go(-1)">
<a href="javascript:history.back()">
뒤로</a>


<a href="#close" ="javascript:window.close();">
종료</a>


<a href="javascipt:main.save();">저장</a>


<img src=이미지경로 ="document.form.reset()" alt="취소">취소


<a href="#" ="Location.reload();">새로고침</a>

<input type="button" value="새로고침" ="javascript:window.Location!.reload()">새로고침버튼


<a href="javascript:window.print()">인
쇄</a>

(DIV를 이용해서 하면 좋다고 한다.)

+ Recent posts