콘텐츠로 건너뛰기

javascript window Object open Method

window Object의 open Method는 브라우저의 새 창을 열때 사용됩니다. 새창의 모양을 설정하는 부분이 항상 기억이 나지 않아 기록해둡니다.
아래 표는 http://www.w3schools.com 에서 복사했습니다.

Syntax

window.open(URL,name,specs,replace);
Parameter Description
URL Optional. Specifies the URL of the page to open. If no URL is specified, a new window with about:blank is opened
name Optional. Specifies the target attribute or the name of the window. The following values are supported: 

  • _blank – URL is loaded into a new window. This is default
  • _parent – URL is loaded into the parent frame
  • _self – URL replaces the current page
  • _top – URL replaces any framesets that may be loaded
  • name – The name of the window
specs Optional. A comma-separated list of items. The following values are supported: 

channelmode=yes|no|1|0 Whether or not to display the window in theater mode. Default is no. IE only
directories=yes|no|1|0 Whether or not to add directory buttons. Default is yes. IE only
fullscreen=yes|no|1|0 Whether or not to display the browser in full-screen mode. Default is no. A window in full-screen mode must also be in theater mode. IE only
height=pixels The height of the window. Min. value is 100
left=pixels The left position of the window
location=yes|no|1|0 Whether or not to display the address field. Default is yes
menubar=yes|no|1|0 Whether or not to display the menu bar. Default is yes
resizable=yes|no|1|0 Whether or not the window is resizable. Default is yes
scrollbars=yes|no|1|0 Whether or not to display scroll bars. Default is yes
status=yes|no|1|0 Whether or not to add a status bar. Default is yes
titlebar=yes|no|1|0 Whether or not to display the title bar. Ignored unless the calling application is an HTML Application or a trusted dialog box. Default is yes
toolbar=yes|no|1|0 Whether or not to display the browser toolbar. Default is yes
top=pixels The top position of the window. IE only
width=pixels The width of the window. Min. value is 100
replace Optional.Specifies whether the URL creates a new entry or replaces the current entry in the history list. The following values are supported: 

  • true – URL replaces the current document in the history list
  • false – URL creates a new entry in the history list

Example :
window.open(‘http://www.w3schools.com’,”, ‘width=400, height=400, resizable=0, scrollbars=0, status=0’);

window Object 의 showModalDialog Method는 HTML 문서를 Modal Dialog Box로 열때 사용합니다.
MSDN 문서를 참조

Syntax

vReturnValue = object.showModalDialog(sURL [, vArguments] [, sFeatures]);

Parameters

sURL Required. String that specifies the URL of the document to load and display.
vArguments Optional. Variant that specifies the arguments to use when displaying the document. Use this parameter to pass a value of any type, including an array of values. The dialog box can extract the values passed by the caller from the dialogArguments property of thewindow object.
sFeatures Optional. String that specifies the window ornaments for the dialog box, using one or more of the following semicolon-delimited values: 

dialogHeight:sHeight
Sets the height of the dialog window (see Remarks for default unit of measure).
dialogLeft:sXPos
Sets the left position of the dialog window relative to the upper-left corner of the desktop.
dialogTop:sYPos
Sets the top position of the dialog window relative to the upper-left corner of the desktop.
dialogWidth:sWidth
Sets the width of the dialog window (see Remarks for default unit of measure).
center:{ yes | no | 1 | 0 | on | off }
Specifies whether to center the dialog window within the desktop. The default is yes.
dialogHide:{ yes | no | 1 | 0 | on | off }
Specifies whether the dialog window is hidden when printing or using print preview. This feature is only available when a dialog box is opened from a trusted application. The default is no.
edge:{ sunken | raised }
Specifies the edge style of the dialog window. The default is raised.
resizable:{ yes | no | 1 | 0 | on | off }
Specifies whether the dialog window has fixed dimensions. The default is no.
scroll:{ yes | no | 1 | 0 | on | off }
Specifies whether the dialog window displays scrollbars. The default is yes.
status:{ yes | no | 1 | 0 | on | off }
Specifies whether the dialog window displays a status bar. The default is yes for untrusted dialog windows and no for trusted dialog windows.
unadorned:{ yes | no | 1 | 0 | on | off }
Specifies whether the dialog window displays the border window chrome. This feature is only available when a dialog box is opened from a trusted application. The default is no.

Example :

window.showModalDialog('example.htm','', 'dialogWidth=830px, dialogHeight=600px, resizalbe=0, scroll=0, status=0');

Modal Window에서 부모창(Opener) 제어 :
Modal Window에서 부모창(Opener)을 제어하기 위해서는

showModalDialog() 의 두번째 매개변수에 현재창을 전달해준다.
window.showModalDialog('example.htm',<strong>self</strong>,  'dialogWidth=830px, dialogHeight=600px, resizalbe=0, scroll=0,  status=0');
Modal Window 에서 전달된 값을 사용할 수 있다.
<strong>var opener = window.dialogArguments;</strong>

 

이 사이트는 광고를 포함하고 있습니다.
광고로 발생한 수익금은 서버 유지 관리에 사용되고 있습니다.

This site contains advertisements.
Revenue generated by the ad servers are being used for maintenance.

댓글 남기기