Modal and Modeless Dialog Boxes: Basic Invocation - Doc JavaScript | WebReference

Modal and Modeless Dialog Boxes: Basic Invocation - Doc JavaScript


Modal and Modeless Dialog Boxes

Basic Invocation

When creating a new window, Internet Explorer lets you generate two types of windows. The first type retains the input focus while open. The user cannot switch windows until the window is closed. This behavior is typical to dialog boxes which you need to close before continuing to other tasks. This kind of dialog box is referred to as a modal dialog box. You create a modal dialog box with showModalDialog(). To show the current page, 2.html, in a modal dialog box, you would go:

window.showModalDialog("2.html");

Click the following button to create a modal dialog box:

Try to switch the input focus to another window. See that you cannot. This button is defined as follows:

<INPUT TYPE="button" VALUE="Push To Create"
  onclick="fnOpenModal()">

The function fnOpenModal() is defined as:

function fnOpenModal(){
  window.showModalDialog("2.html")
}

The second type of dialog boxes is referred to as a modeless dialog box. A modeless dialog box allows you to switch the input focus to another window. It continues to display even when you switch to other applications. A modeless dialog box is useful for menus and help systems. It allows the user to use the dialog box and the application window concurrently. You create a modeless dialog box with showModelessDialog(). To show the current page, 2.html, for example, in a modeless dialog box, you would go:

window.showModelessDialog("2.html");

Click the following button to create a modeless dialog box:

Try to switch the input focus to other windows. See that you can do it this time. This button is defined as follows:

<INPUT TYPE="button" VALUE="Push To Create"
  onclick="fnOpenModeless()">

The function fnOpenModeless() is defined as:

function fnOpenModeless(){
  window.showModelessDialog("2.html")
}

Next: How to specify the different arguments when creating dialog boxes

http://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: August 13, 2001
Revised: August 13, 2001

URL: http://www.webreference.com/js/column90/2.html