본문 바로가기

블로그 공학/단기 컨텐츠

window.open 팝업창 열기

<HTML>
 <HEAD>
  <TITLE> child.html </TITLE>

 </HEAD>

 <BODY>
 


 </BODY>
</HTML>

 

<HTML>
 <HEAD>
  <TITLE> n1019_2.html </TITLE>
  <script language="javascript">
  <!--
    var obj=null;
 function winOpen(choice){
     switch(choice){
   case 'open':
       obj=window.open("child.html","view","width=400 height=300");
       var html="";
    if(obj!=null){
    
       html+="<html>";
    html+="<head><title>child</title><head>";
    html+="<body>";
       html+="<h3>child문서입니다</h3>";
    html+="</body></html>";

    obj.document.write(html);
    }
    break;
   case 'close': if(obj!=null)window.close; 
    break;
 }
 }
  //-->
  </script>

 </HEAD>

 <BODY>
  <b>n1019_2.html문서입니다<b>
  <input type="button" value="새창 열기" onClick="winOpen('open')">
  <input type="button" value="닫기" onClick="winOpen('close')">


 </BODY>
</HTML>