자식창에서 부모창 바뀌에 하는 방법!
본문
팝업창이 처음에 하나 나오고 그 다음 클릭해서(_blank) 또 하나가 나온 상태입니다.
현재 이 팝업창을 이용해 현재 띄워져있는 두개의 창은 닫고 상위2칸앞인 부모창을 바꾸려면 어떻게 해야할까요?
이건 자식창의 소스입니다.
<script language="JavaScript">
<!--
function notice_setCookie( name, value, expiredays ) {
var todayDate = new Date();
todayDate.setDate( todayDate.getDate() + expiredays );
document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}
function notice_closeWin() {
if ( document.forms[0].Notice.checked )
notice_setCookie( "Notice20150317", "done" , 1); // 1=하룻동안 공지창 열지 않음
self.close();
}
function close_popup01() {
//opener.location.href="/community/event_read.html?idx=3";
window.close();
}
function na_call(str){ eval(str);}
//-->
</script>
<style type="text/css">
body {
margin: 0;
padding: 0;
font-size: 12px;
color: #666;
}
</style>
<TABLE width=400 height="1335" border=0 cellPadding=0 cellSpacing=0>
<form name="noticeForm">
<TBODY>
<tr>
<td colspan="4">
<img src="20150317/1.png" width="400" height="970" alt=""></td>
</tr>
<tr>
<td rowspan="2">
<img src="20150317/2.png" width="111" height="321" alt=""></td>
<td>
<a href="★/test.html">
<img src="20150317/3.png" width="181" height="32" border="0" alt=""></a></td>
<td colspan="2" rowspan="2">
<img src="20150317/4.png" width="108" height="321" alt=""></td>
</tr>
<tr>
<td>
<img src="20150317/5.png" width="181" height="289" alt=""></td>
</tr>
<tr>
<td width="111" height="24" background="★/btm.jpg"><input type="checkbox" name="Notice" value='1' onclick="notice_closeWin();" style="vertical-align:middle;" /> 오늘 하루 이창 </td>
<td height="26" width="181" background="★/btm.jpg">을 열지 않습니다</td>
<td height="26" width="43"background="★/btm.jpg"></td>
<td width="66"><a href="#" onclick="notice_closeWin();">
<input type="image" src="20140903/btn.jpg" style="vertical-align:middle;" border="0" alt="닫기" />
</a></td>
</tr>
</form>
<td height="12"></TBODY>
</TABLE>
</body>
</html>
답변 2
1. 부모창에서 팝업창을 띄울때
pop1=window.open(~~~)
pop2=window.open(~~~)
2. 부모창에 함수를 하나 만듭니다
function closebypop(){
필요한 조작들~~~
pop1.close();
pop2.close();
}
3. pop2에서 부모창 함수를 호출 합니다
opener.closebypop()
답변을 작성하시기 전에 로그인 해주세요.