JavascriptshowModalDialog _ javascript skills for passing values between two forms

Source: Internet
Author: User
In the previous article, how to use Javascript to pass values between two forms explains how to use the window. open () method to open a new form and transfer values between two forms. Code for passing values between two Javascript forms
In javascript, there is also a function window. showModalDialog which can also open a new form. However, it opens a modal window. How can we pass a value between the parent form and the child form? Let's first look at the definition of this function: vReturnValue = window. showModalDialog (sURL [, vArguments] [, sFeatures])
Parameter description:
SURL -- required parameter; Type: String. Specifies the URL of the document to be displayed in the dialog box.
VArguments -- optional parameter; Type: variant. Used to pass parameters to the dialog box. The passed parameter types are not limited, including arrays. The dialog box uses window. dialogArguments to obtain the passed parameters.
SFeatures -- optional parameter; Type: String. Used to describe the appearance and other information of the dialog box. You can use one or more of the following, separated by semicolons.
DialogHeight: the dialog box height. The default unit of dialogHeight and dialogWidth in IE4 is em, while that in IE5 is px. For convenience, when defining the modal mode dialog box, unit with px.
DialogWidth: Dialog Box width.
DialogLeft: the distance from the left of the screen.
DialogTop: the distance from the screen.
Center: {yes | no | 1 | 0}: whether the window is centered. The default value is yes, but the height and width can still be specified.
Help: {yes | no | 1 | 0}: whether to display the help button. The default value is yes.
Resizable: {yes | no | 1 | 0} [IE5 +]: whether the size can be changed. No by default.
Status: {yes | no | 1 | 0} [IE5 +]: whether to display the status bar. The default value is yes [Modeless] or no [Modal].
Scroll: {yes | no | 1 | 0 | on | off}: Specifies whether the scroll bar is displayed in the dialog box. The default value is yes.
For example, "dialogWidth = 200px; dialogHeight = 100px"
Therefore, we can pass values between two forms using the window. dialogArguments parameter.
For example, the following two pages: FatherPage.htm:

The Code is as follows:


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.