1. 새창 [자동] 띄우기 소스
<head>와 </head> 사이
<script language="JavaScript">window.open("new_pop_01.htm",'_blank',
'toolbar=no,location=no,status=no,menubar=no,
scrollbars=auto,resizable=no,directories=no,width=400,height=400,top=100,left=100')</script>
2. 새창 [클릭으로] 띄우기 -> href 사용
간단하게 :-)
<a href="#" onClick="window.open('주소','팝업이름','width=가로,height=세로'))">Link</a>
복잡하게 :-(
<a href="#" onClick="window.open('http://www.naver.com','_blank',
'toolbar=no,location=no,status=no,menubar=no, scrollbars=auto,resizable=no,directories=no,
width=400,height=400, top=10,left=10')">
클릭하면 새창팝업띄우기
</a>
3. 새창 [클릭으로] 띄우기 -> 스크립트 사용
<head>와 </head> 사이
<SCRIPT language="JavaScript">
function PopWin(url, w, h, sb) {
var newWin;
var setting = "width="+w+", height="+h+", top=5, left=20, scrollbars="+sb;
newWin = window.open (url, "", setting);
newWin.focus();
}
</SCRIPT>
<body>와 </body> 사이
<a href="javascript:PopWin('http://www.naver.com','400','400','no');">클릭하면 새창</a>
4. 열린새창(팝업)에 이미지에 닫기 링크걸기
onClick="window.close()"/
<html>
<head><title>팝업닫기</title></style></head>
<body>
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<img src="img.jpg" width="400" height="400" onClick="window.close()"/>
</td>
</tr>
</table>
</body>
</html>
5. 열린새창(팝업)에 링크 클릭시 새창이 닫히고 부모창의 링크로 이동
<head>와 </head> 사이
<SCRIPT language=javascript>
<!--
function MovePage() {
window.opener.top.location.href=" http://www.naver.com"
window.close()
}
//-->
</SCRIPT>
<body>와 </body> 사이
<IMG border=0 alt="" src="img.jpg" width=397 height=231
useMap=#Map>
<MAP name=Map>
<AREA style="CURSOR: hand" href="javascript:MovePage();" shape=rect
coords=149,194,252,220></MAP> --> 이미지맵 사용한경우
'개발 > PHP' 카테고리의 다른 글
[jquery] 리프래쉬 없는 컨펌창 :: refresh confirm (0) | 2019.03.18 |
---|---|
jquery:: file ajax upload [ajax 파일업로드] (0) | 2019.03.14 |
[Jquery/php/html] 아이프레임(iframe) 에서 다른 아이프레임(iframe) 새로고침하기 (0) | 2018.07.09 |
[script]PHP::숫자 영문 혼합 카운트 증가// 영문숫자조합 자동증가 (0) | 2018.06.26 |
[PHP] 현재페이지 URL 정보 가져오는 방법 (0) | 2018.05.08 |