HTML - Popup 부모창의 function 호출

분류없음 2013.12.11 17:12 Posted by 파란크리스마스
출처 : www.jasko.co.kr

opener_page.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="content-type" content="text/html; charset=euc-kr">
<TITLE>Jasko Sample Script</TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--

function openWin() {
	myWin = window.open('popup_page.html', 'popwindow', 'width=600,height=300');
	myWin.focus();
}

function callMe(param1, param2) {
	alert('param1 = ' + param1);
}

//-->
</SCRIPT>
</HEAD>

popup_page.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<META http-equiv="content-type" content="text/html; charset=euc-kr">
<TITLE>Jasko Sample Script</TITLE>
</HEAD>
<SCRIPT LANGUAGE="JavaScript">
<!--

function closePopup() {
    window.opener.callMe(1, '2');
    window.close();
  }

//-->
</SCRIPT>
<BODY>

	<input type=button onclick="alert('현재창의 이름은 : ' + window.name)" value="현재창의 이름">
	<input type=button onclick="closePopup();" value="오프너윈도우의 함수호출">

</BODY>
</HTML>




 

티스토리 툴바