Window open() Method Syntax .open(URL, name, specs, replace) Parameter Values

Parame Description ter

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, or tab. This is default  _parent - URL is loaded into the parent  _self - URL replaces the current page  _top - URL replaces any framesets that may be loaded  name - The name of the window (Note: the name does not specify the title of the new window) specs Optional. A comma-separated list of items, no whitespaces. The following values are supported:

channelmode=yes|no|1|0 Whether or not to display the window in theater . Default is no. IE only

directories=yes|no|1|0 Obsolete. 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. Negative values not allowed

location=yes|no|1|0 Whether or not to display the address field. Opera only

menubar=yes|no|1|0 Whether or not to display the bar

resizable=yes|no|1|0 Whether or not the window is resizable. IE only

=yes|no|1|0 Whether or not to display scroll bars. IE, Firefox & Opera only status=yes|no|1|0 Whether or not to add a

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

=yes|no|1|0 Whether or not to display the browser toolbar. IE and Firefox only

top=pixels The top position of the window. Negative values not allowed

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:

Click the to write some text in the new window and the source (parent) window.

………………………………………*****************…………………………….

JavaScript supports three important types of dialog boxes. These dialog boxes can be used to raise and alert, or to get confirmation on any input or to have a kind of input from the users. Here we will discuss each dialog box one by one. Alert Dialog Box An alert dialog box is mostly used to give a warning message to the users. For example, if one input field requires to enter some text but the user does not provide any input, then as a part of validation, you can use an alert box to give a warning message. Nonetheless, an alert box can still be used for friendlier messages. Alert box gives only one button "OK" to select and proceed. Example

Click the following button to see the result:

Confirmation Dialog Box A confirmation dialog box is mostly used to take user's consent on any option. It displays a dialog box with two buttons: OK and Cancel. If the user clicks on the OK button, the window method confirm() will return true. If the user clicks on the Cancel button, then confirm() returns false. You can use a confirmation dialog box as follows. Example

Click the following button to see the result:

Prompt Dialog Box The prompt dialog box is very useful when you want to pop-up a to get user input. Thus, it enables you to interact with the user. The user needs to fill in the field and then click OK. This dialog box is displayed using a method called prompt() which takes two parameters: (i) a which you want to display in the text box and (ii) a default string to display in the text box. This dialog box has two buttons: OK and Cancel. If the user clicks the OK button, the window method prompt() will return the entered value from the text box. If the user clicks the Cancel button, the window method prompt() returns null. Example

Click the following button to see the result: