예를 들어, FatherPage.htm이라는 새로운 양식을 생성합니다: XML-Code: 코드 복사 코드는 다음과 같습니다. 다음: <BR>function OpenChildWindow() <BR>{ <BR>window.open('ChildPage.htm'); >} <BR>< /script> <BR><input type="text" id="txtInput" /> <BR><input type="button" value="OpenChild" onclick="OpenChildWindow( )" /> <BR><BR> 그런 다음 ChildPage.htm에서 window.opener를 통해 상위 양식의 요소에 액세스할 수 있습니다. XML 코드: 코드 복사 코드는 다음과 같습니다. () <BR>{ <BR>window .opener.document.getElementById('txtInput').value <BR>=document.getElementById('txtInput').value <BR>window.close(); } <BR> 사실 하위 양식을 여는 동안 하위 양식의 요소에 값을 할당할 수도 있습니다. window.open 함수도 하위 양식에 대한 참조를 반환하기 때문입니다. 따라서 FatherPage.htm을 다음과 같이 수정할 수 있습니다. XML 코드: 코드 복사 코드는 다음과 같습니다. function OpenChildWindow() { var child = window.open('ChildPage.htm'); child.document.getElementById('txtInput').value =document.getElementById('txtInput').value; } 하위 양식이 비어 있으면 하나의 하위 양식만 열도록 제어할 수도 있습니다. 양식: XML 코드: 코드 복사 코드는 다음과 같습니다. var child function OpenChildWindow() { if(!child ) child = window.open('ChildPage.htm'); child.document.getElementById('txtInput').value =document.getElementById('txtInput').value } 그것만으로는 충분하지 않습니다. 하위 폼을 닫을 때 상위 폼의 하위 변수도 지워야 합니다. 그렇지 않으면 하위 폼을 연 후 다시 열 수 없습니다. 닫힘: XML 코드: 코드 복사 코드는 다음과 같습니다. 함수 SetValue() { window.opener.document.getElementById(' txtInput').value =document.getElementById('txtInput').value; window.close() } function Unload() { window.opener .child=null; } < ;input type="text" id="txtInput" />