Javascript Reference
Categories: window

javascript window showModalDialog( )

@March 4, 2010, 3:15 a.m.
showModalDialog( ) It works on all browsers.

showModalDialog("URL"[, arguments[, "features"]])


Displays a special window that remains atop all browser windows until the user explicitly closes the dialog window. This kind of window is different from the browser windows generated with the ) method. A modal dialog has no scriptable relationship with its opening window once the dialog window is opened. All values necessary for displaying content must be in the HTML document that loads into the window or be passed as parameters. The modal dialog may then have a script set its returnValue property, which becomes the value returned to the original script statement that opened the modal dialog box as the returned value of the showModalDialog( ) method.

You can pass arguments to the modal dialog by creating a data structure that best suits the data. For a single value, a string will do. For multiple values, you can create a string with a unique delimiter between values, or create an array and specify the array as the second parameter for the showModalDialog( ) method. A script in the document loaded into the modal dialog can then examine the window.dialogArguments property and parse the arguments as needed for its scripting purposes. See the dialogArguments property for an example.

The third optional parameter lets you set physical characteristics of the dialog window. These characteristics are specified in a CSS-style syntax. Dimensions for dialogWidth, dialogHeight, dialogLeft, and dialogTop should be specified in pixels. An example of a call to a modal dialog is as follows:

var answer = window.showModalDialog("subDoc.html",argsVariable, 
"dialogWidth:300px; dialogHeight:200px; center:yes");

None of the third parameter characteristics are recognized by the Macintosh version of Internet Explorer 4, which creates a full-size modal dialog.

Modal dialogs can present problems for scripts if the window loads a frameset. A script in one of the frames will likely not be able to reference the parent or top window to gain access to either the window's close( ) method or content in another frame.

Feature Value Description
center yes | no | 1 | 0 | on | off Center the dialog
dialogHeight Length/units Outer height of dialog
dialogLeft Integer Left pixel offset (overrides center)
dialogTop Integer Top pixel offset (overrides center)
dialogWidth Length/units Outer width of dialog
edge raised | sunken Transition style between border and content area
help yes | no | 1 | 0 | on | off Display help icon in titlebar
resizable yes | no | 1 | 0 | on | off Dialog is resizable
status yes | no | 1 | 0 | on | off Display status bar
  • A complete or relative URL as a string.
  • Data as a number, string, or array to be passed to the scripts in the document loaded into the modal dialog.
  • A string of semicolon-delimited style attributes and values to set the physical characteristics of the modal dialog. Available attributes are as shown in the following table.
Returned Value

The value (if any) assigned to the window.returnValue property in the document loaded into the modal dialog window.

$500 loan <a href="">personal loans online for bad credit</a> loans today <a href=>payday loans online bad credit ok</a> how long to pay off a loan
instalment loans online <a href="">fast personal loans online</a> 3 year loans <a href=>cash advance roanoke va</a> apply for small loan
loans las vegas <a href="">emergency personal loans bad credit</a> check loans <a href=>need loan today</a> 2500 loan
loan today <a href="">pacific cash advance</a> get loan fast <a href=>first time loan</a> installment loans bad credit online
payday loans - 3 weeks
manufactured homes loans <a href="">emergency cash assistance</a> tribal loans <a href=>fast loans with monthly payments</a> personal loan bad credit online
startup loans bad credit <a href="">cash loan with bad credit</a> loans in minutes <a href=>money loans bad credit</a> interest on loans
best long term installment loans for bad credit <a href="">short term personal loans</a> personal debt consolidation <a href=>personal loans reviews</a> loan rates
bad credit personal loan <a href="">short term loans compare</a> loan against tax return <a href=>payday loans surrey b c</a> fast loans for bad credit with monthly payments
payday loans - 3 weeks
california loans <a href="">90 day loans</a> loans for bad credit online <a href=>loan online application</a> 30 day loans
personal loans usa <a href="">loan advance</a> loans in pa <a href=>free cash online</a> internet loan
2600 installment loans california <a href="">personal loan fast</a> cash loan with bad credit <a href=>online cash register</a> personal loan for debt consolidation
fast loan with bad credit <a href="">texas payday loan</a> loans in milwaukee <a href=>easy loan</a> installment loan for bad credit
payday loans - 3 weeks

Powered by Linode.