인터넷정보

html문서 없이 이미지 새창띄우기

알 수 없는 사용자 2007. 10. 18. 14:01
<html>
<head>

<script language="JavaScript">
<!--
var win1Open = null

function displayImage(picName, windowName, windowWidth, windowHeight){
return window.open(picName,windowName,"toolbar=no,scrollbars=no,resizable=no,width=" + (parseInt(windowWidth)+20) + ",height=" + (parseInt(windowHeight)+15))
}

function winClose(){
if(win1Open != null) win1Open.close()
}

function doNothing(){}
//-->
</script>

<script language="JavaScript1.1">
<!--

function displayImage(picName, windowName, windowWidth, windowHeight){
var winHandle = window.open("" ,windowName,"toolbar=no,scrollbars=no,resizable=no,width=" + windowWidth + ",height=" + windowHeight)
if(winHandle != null){
var htmlString = "<html><head><title>- 갤러리 -</title></head>"
htmlString += "<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>"
htmlString += "<a href=javascript:window.close()><img src=" + picName + " border=0 alt=닫기></a>"
htmlString += "</body></html>"
winHandle.document.open()
winHandle.document.write(htmlString)
winHandle.document.close()
}
if(winHandle != null) winHandle.focus()
return winHandle
}
//-->
</script>

</head>
<body>
<a href="javascript:doNothing()" onClick="win1Open=displayImage('img/img1.gif', 'popWin1', '242', '297')" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''"><img src="img/img1.gif" border="1" width="87" height="107"></a>

<a href="javascript:doNothing()" onClick="win1Open=displayImage('img/img2.gif', 'popWin1', '242', '297')" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''"><img src="img/img2.gif" border="1" width="87" height="107"></a>

<a href="javascript:doNothing()" onClick="win1Open=displayImage('img/img3.gif', 'popWin1', '242', '297')" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''"><img src="img/img3.gif" border="1" width="87" height="107"></a>

<a href="javascript:doNothing()" onClick="win1Open=displayImage('img/img4.gif', 'popWin1', '242', '297')" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''"><img src="img/img4.gif" border="1" width="87" height="107"></a>

</body>
</html>




<head>와 </haed>사이에 위와 같이 소스를 넣는다
- 안젤리나 졸리 - 라고 써있는 부분이 새창 타이틀바에 써질 부분이다 수정하세여 ^^

<body>와 </body>사이에 그림이 보여질곳에 아래 소스를 넣는다

<a href="javascript:doNothing()" onClick="win1Open=displayImage('이미지주소", 'popWin1', '원본이미지 가로크기', '원본이미지 세로크기")" onMouseOver="window.status='Click to display picture'; return true;" onMouseOut="window.status=''"><img src="이미지주소" border="테두리두께" width="가로크기" height="세로크기"></a>
반응형