Ãâ·Â ½ºÆ®¸²À» ´Ý°í º¸³»Áø µ¥ÀÌÅ͸¦ °­Á¦·Î µð½ºÇ÷¹ÀÌÇÏ¿© document.open ¸Þ¼­µå·Î ¿¬ ¹®¼­¸¦ ´Ý´Â´Ù.

Àμö/ÆĶó¸ÞÅÍ
document : (¹®ÀÚ¿­ °³Ã¼)
ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ÇöÀçÀÇ ¹®¼­¸¦ ³ªÅ¸³»´Â document °³Ã¼ÀÌ´Ù.
close : (´Ý±â ¸Þ¼­µå)

ÇʼöÀûÀÎ ¿ä¼ÒÀ̸ç, ÇöÀç ¹®¼­À» ´Ý´Â ¸Þ¼­µåÀÌ´Ù.

ÀÌ ¸Þ¼­µå´Â ÆĶó¸ÞÅÍ°¡ ¾ø´Ù

¹Ýȯ°ª

¹Ýȯ°ªÀº ¾ø´Ù.

¼³¸í

close ¸Þ¼­µå´Â ÀÌÀü¿¡ document.open() ¸Þ¼­µå·Î ¿¬ ¹®¼­¸¦ ´Ý´Â´Ù.

¹®¼­¸¦ ´ÝÀ¸¸é document.write() ¸Þ¼­µå³ª document.writeln() ¸Þ¼­µå¿¡¼­ ¼öÁýÇÑ µ¥ÀÌÅ͸¦ µð½ºÇ÷¹ÀÌ ÇÑ´Ù.

Ư±â

window.open(), window.close()¿Í document.open(), document.close()´Â ±¸º°ÇÏ¿©¾ß ÇÑ´Ù.

¾î¶² °³Ã¼¿¡¼­ close ¸Þ¼­µå¸¦ È£ÃâÇÏ¿© event°¡ ¹ß»ýµÇ¸é, window.close ¸Þ¼­µå°¡ ÀÛ¿ëµÈ´Ù.

ÀÌ ÆäÀÌÁö¸¦ Ŭ¸¯Çϸé window.close ¸Þ¼­µå°¡ È£ÃâµÈ´Ù.

<SCRIPT LANGUAGE="JScript">
function doClose(){
  close();
}
</SCRIPT>
<BODY onclick="doClose();">
Click this page and window.close() is called.
</BODY>

¾î´À °³Ã¼¿¡¼­µç ¸Þ¼­µå°¡ È£ÃâµÇ¸é ÀÌ document.close ¸Þ¼­µå°¡ Àû¿ëµÈ´Ù.

ÁÖÀÇ : document.writeÀ̳ª document..writelnÀÌ À̺¥Æ®Ã³¸®ÀÚ¿¡¼­ »ç¿ëµÇ¸é, document.closeµµ ÀÚµ¿ÀûÀ¸·Î »ç¿ëµÈ´Ù.

´ÜÃ߸¦ Ŭ¸¯Çϸé document.close ¸Þ¼­µå°¡ È£ÃâµÈ´Ù.

<BUTTON onclick="close();">¹®¼­ ´Ý±â</BUTTON>
Àû¿ë
°³Ã¼scriptIE
ÂüÁ¶
open

ÀÌ ¸Þ¼­µå´Â (¿µ¾î)DOM Level 1(Document Object Model Level 1)¿¡¼­ Á¤ÀǵǾú´Ù.



°£´ÜÇÑ document.open, close ¸Þ¼­µå ¿¹Á¦

<SCRIPT>
function newWinTest(){
  newWin=window.open('','','toolbar=no,scrollbars=no,width=300,height=150,left=300,top=200');
  var str1='<CENTER>¾È³çÇϼ¼¿ä !<BR>';
  var str2='¿¬½ÀÀÔ´Ï´Ù.<BR>';
  newWin.document.open('text/html','replace');
  newWin.document.writeln(str1);
  newWin.document.write(str2);
  newWin.document.write('document.mimeType='+document.mimeType+'<BR>');
  newWin.document.write('document.charset='+document.charset+'<BR>');
  newWin.document.writeln('<FORM><INPUT type=button value=´Ý±â onClick="window.close()>');
  newWin.document.write('</FORM></CENTER>');
  newWin.document.close();
}
</SCRIPT>

<FORM><INPUT type="button" value="»õâ ¿­±â" onClick="newWinTest()"></FORM>