Use of the ShowModalDialog command

Source: Internet
Author: User

Syntax Copy

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" 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 Thedialogarguments property of Thewindow object.
Sfeatures Optional.Stringthat specifies the Windows Ornaments for the dialog box, using one or more of the following semicolon-delimited Values:dia Logheight:sheight Sets The height of the dialog window (the remarks for default unit of measure). Dialogleft:sxpos Sets the left position of the dialog window relative to the Upper-left corner. Dialogtop:sypos Sets The top position of the dialog window relative to the Upper-left corner. Dialogwidth:swidth Sets The width of the dialog window (the 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 isYes. dialoghide:{Yes | no | 1 | 0 | on | off} Specifies whether the dialog window was hidden when printing or using print prev Iew. This is the available when a dialog box are opened from trusted application. The default isNo. edge:{Sunken | raised} Specifies the edge style of the dialog window. The default israised. resizable:{Yes | no | 1 | 0 | on | off} Specifies whether the dialog window has fixed dimensions. The default isNo. scroll:{Yes | no | 1 | 0 | on | off} Specifies whether the dialog window displays scrollbars. The default isYes. status:{Yes | no | 1 | 0 | on | off} Specifies whether the dialog window displays a status bar. The default isYesFor untrusted dialog windows andNoFor trusted dialog Windows. unadorned:{Yes | no | 1 | 0 | on | off} Specifies whether the dialog window displays the Border window chrome. This is the available when a dialog box are opened from trusted application. The default isNo.

return Value

Variant. Returns the value of the ReturnValue property as set by the window of the document specified in sURL.

remarks

A modal dialog box retains the input focus while open. The user cannot switch Windows until the dialog box is closed.

Because a modal dialog box can include a URL to a resource in a different domain, does not pass information through ments parameter that the user might consider private. Thevarguments parameter can be referenced within modal dialog box using thedialogarguments property of The window object. If thevarguments parameter is defined as a string, the maximum string length this can be passed to the modal dialog box is 4096 characters; Longer strings are truncated.

You can set the default font settings the same way your set cascading Style Sheets (CSS) attributes (for example, "Font:3;fo Nt-size:4 "). To define multiple font values, use multiple font attributes.

To override center, even though of the default for center Isyes, you can specify eitherdialogleft the and/or.

When Windows Internet Explorer opens a window is modal or modeless HTML dialog box by using theshowmodaldialog method or by using Theshowmodelessdialog method, Internet Explorer uses Component Object Model (COM) to create a new ins Tance of the window. Typically, the ' window is opened ' by using the ' the ' ' The ' the ' the ' the ' the ', ' existing Internet Explorer When Internet Explorer opens the "window in a" new process, all the memory cookies are no longer available, including the SE Ssion ID. This process was different from the process that Internet Explorer uses to open a new window by using TheOpen method.

For Internet Explorer 7, dialogheight and dialogwidth return the height and width of the content area and no longer includ Es the height and width of the frame.

Internet Explorer 7. Although a user can manually adjust the height of a dialog box to a smaller value-provided the dialog box is resizable-t He minimumdialogheight can specify are pixels, and the minimumdialogwidth you can define are-pixels. In versions earlier than Internet Explorer 7 The minimum value of thedialogwidth, that can, specified is pixels.

Note For Internet Explorer 7, help isn't a valid value for Sfeatures. In previous versions, help:{yes | no. | 1 | 0 | on | off} specified whether the dialog window displays the Context-sensit Ive help icon.

This method must the use a user-initiated action, such as clicking on a link or tabbing to a link and pressing ENTER, to OP En a pop-up window. The Pop-up Blocker feature in Microsoft Internet Explorer 6 blocks windows this are opened without being initiated by the User.

Internet Explorer 5 and later allows further control over modal dialog boxes through Thestatus andresizable values in t He sfeatures parameter to the ShowModalDialog method. Turn off the status bar by calling the dialog box from a trusted application, such as Microsoft Visual Basic or a HTML Ap Plication (HTA), or from a trusted window, such as a trusted modal dialog box. These applications are considered to is trusted because they use Internet Explorer interfaces instead of the browser. Any dialog box generated from trusted source has to the status bar turned off by default. Resizing is turned from default, but can turn it on by Specifyingresizable=yes in thesfeatures string of the showmodaldialog method.

The default unit of measure for Dialogheight and dialogwidth in Internet Explorer 5 and later is the pixel. The value can is an integer or floating-point number, followed by a absolute units designator (CM,MM, in, PT, or PC) or a Relative units designator (Em,ex, or px). For consistent results, specify thedialogheight anddialogwidth to pixels when designing modal.

As of Internet Explorer 4.0, can eliminate scroll bars on dialog boxes. To turn off the scroll bar, set Thescroll attributes Tofalse in Thebody Element for the dialog window, or call the Modal di Alog box from a trusted application.

examples

This example uses the ShowModalDialog method to open a customized dialog box. Copy

 <script type= "Text/javascript" > Function fnrandom (imodifier) {return parseint (Math.random () *imodifier);
   function Fnsetvalues () {var iheight=oform.oheight.options[oform.oheight.selectedindex].text;
   if (Iheight.indexof ("Random") >-1) {iheight=fnrandom (document.body.clientHeight);
   } var sfeatures= "dialogheight:" + iheight + "px;";
return sfeatures;
   function Fnopen () {var sfeatures=fnsetvalues (); window.showModalDialog ("showmodaldialog_target.htm", "", Sfeatures)} </script> <form name= "Oform" > Di 
		Alog Height <select name= "Oheight" > <option>--Random--</option> <option>150</option> <option>200</option> <option>250</option> <option>300</option> </select> 
	; Create Modal Dialog box <input type= "button" value= "Push to Create" onclick= "Fnopen ()" > </form> 

Code Example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog2.htm

Linked from the following button was an extended version of the above script, which demonstrates many of the features avail Able for creating a custom dialog box.

Code Example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialog.htm

Neither modal nor modeless HTML dialog boxes text support or the selection standard menu for copy shortcut; However, can imitate this functionality by using script Withtextrange objects and event handlers Foronmousedown Ousemove, as in the following example.

Code Example: http://samples.msdn.microsoft.com/workshop/samples/author/dhtml/refs/showModalDialogLaunch.htm

Standards Information

There is no public standard which applies to this method.

applies to

Window,window Constructor

Also About the Pop-up blocker, showmodelessdialog

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.