본문 바로가기

IT/수원스터디

2-2. JS, opener로 값 보내기


 opener.html

<!doctype html>

<html>

 <head>

  <meta charset="UTF-8">

  <title>Document</title>

 <script>

function test1(){

window.open("./test.html","name","","");

}

 

 

 </script>

 

 </head>

 

 

 <body>

<form name="frm">

<button onclick="test1()">버튼</button> 


<input type="text" name="test">

</form>

 </body>

</html>




test.html

<!doctype html>

<html>

 <head>

  <meta charset="UTF-8">

  <title>Document</title>

 

 </head>

 

 <script>

function test2(){

opener.document.frm.test.value=document.frm2.test2.value;

window.close();


}

 </script>

 

 <body>

<form name="frm2">


<input type="text" name="test2" value="">


</form>


<button onclick="test2()">닫기</button>

 

 </body>

</html>

 




'IT > 수원스터디' 카테고리의 다른 글

동적테이블, 체크박스 전체 체크, 버튼..value  (0) 2014.08.24
동적테이블등.. 과제 body 부분  (0) 2014.08.17
2. JS(java script)  (2) 2014.08.11
1. HTML  (0) 2014.07.10
0. 시작  (0) 2014.07.10