showModelessDialog Method

DHTML, HTML, & CSS

showModelessDialog Method


Creates a modeless dialog box that displays the specified HTML document.

Syntax

vReturnValue = window.showModelessDialog(sURL [, vArguments][, sFeatures])

Parameters

sURLRequired. String that specifies the URL of the document to load and display.
vArgumentsOptional. 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 the window object.
sFeaturesOptional. String that specifies the window ornaments for the dialog box, using one or more of the following semicolon-delimited values:
dialogHeight:iHeight Sets the height, in pixels, of the dialog window.
dialogLeft:iXPos Sets the left position of the dialog window relative to the upper-left corner of the desktop.
dialogTop:iYPos Sets the top position of the dialog window relative to the upper-left corner of the desktop.
dialogWidth:iWidth Sets the width, in pixels, of the dialog window.
center:{ yes | no | 1 | 0 }Specifies whether to center the dialog window within the desktop. The default is yes.
help:{ yes | no | 1 | 0 }Specifies whether the dialog box displays the context-sensitive Help icon. The default is yes.
resizable:{ yes | no | 1 | 0 }Specifies whether the dialog window has set dimensions. The default for trusted and untrusted dialog windows is no.
status:{ yes | no | 1 | 0 }Specifies whether the dialog window displays a status bar. The default is yes for untrusted dialog windows and no for trusted dialog windows.

Return Value

Variant. Returns a reference to the new window object. Use this reference to script properties and methods on the new window.

Remarks

The modeless dialog box displays even when the user switches input focus to the window.

The showModelessDialog method is useful for menus and Help systems. When you invoke this method, a dialog box appears, layered in front of the browser window or HTML Application (HTA).

By convention, modeless dialog boxes can differ from an application window in that they do not have scroll bar, status bar, or resize capabilities. To create this type of dialog box, implement the following steps:

  • Turn off the scroll bar. Use the SCROLL attribute by including the scroll="no" value in the BODY tag for the dialog window.
  • Turn off the status bar. Set the value of status to no in the sFeatures parameter of the showModelessDialog call. A second option is to call the dialog window from a trusted application, such as Microsoft® Visual Basic® or an HTA, or from a trusted window, such as a trusted dialog box. These are considered trusted because they use Internet Explorer interfaces instead of the browser. The status bar of any dialog box generated from a trusted source is set to off by default.
  • Do not allow resizing. Resizing is set to off by default.

To create a return value for showModelessDialog, set the vArguments parameter to a callback function or an object in the showModelessDialog call. In the modeless dialog box, you can reference this function or object through the dialogArguments property of the window object. The same arguments are valid for the showModelessDialog and showModalDialog methods.

You can set the default font settings the same way you set cascading style sheets (CSS) attributes (for example, "font:3; font-size:4"). To define multiple font values, use multiple font attributes.

To override center, even though the default for center is yes, you can specify either dialogLeft and/or dialogTop.

Although a user can manually adjust the height of a dialog box to a smaller value—provided the dialog box is resizable—the minimum dialogHeight you can specify is 100 pixels.

Example

This example uses the showModelessDialog method to create a return value. It also shows how to handle user actions in the modeless dialog box.

Sample Code

<HEAD>
<SCRIPT>
// Supplies a return value from modeless dialog box.
var sUserName="";              

// Passes URL and file name of dialog box as a variable.
var oDialog = "myDialog.htm";  

// Passing the window object allows for the creation of a 
// callback to return information from the modeless dialog box.

function fnCallDialog()                                             
{
   showModelessDialog(oDialog,window,
      "status:false;dialogWidth:300px;dialogHeight:300px");
}

</SCRIPT>
</HEAD>
This feature requires Microsoft Internet Explorer 5 or later. Click the icon below to install the latest version. Then reload this page to view the sample.
Microsoft Internet Explorer

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
window

Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.