Home >
Article > Web Front-end > Javascript showModalDialog Passing values between two forms_javascript skills
Javascript showModalDialog Passing values between two forms_javascript skills
WBOYOriginal
2016-05-16 18:45:431030browse
Javascript value transfer implementation code between two forms There is also a function window.showModalDialog in javascript that can also open a new form, but it opens a modal window, so how to What about passing values between parent form and child form? Let’s look at the definition of this function first: vReturnValue = window.showModalDialog(sURL [, vArguments] [,sFeatures]) Parameter description: sURL--Required parameter, type: string. Used to specify the URL of the document to be displayed in the dialog box. vArguments--optional parameters, type: variant. Used to pass parameters to the dialog box. The type of parameters passed is not limited, including arrays, etc. The dialog box obtains the parameters passed in through window.dialogArguments. sFeatures--optional parameters, type: string. Used to describe the appearance of the dialog box and other information, you can use one or more of the following, separated by semicolons ";". dialogHeight: height of the dialog box, not less than 100px. The default unit of dialogHeight and dialogWidth in IE4 is em, while in IE5 it is px. For convenience, when defining a modal dialog box, use px as the unit. dialogWidth: Dialog width. dialogLeft: distance from the left side of the screen. dialogTop: distance from the screen. center: {yes | no | 1 | 0}: Whether the window is centered, the default is yes, but the height and width can still be specified. help: {yes | no | 1 | 0}: Whether to display the help button, the default is yes. resizable: {yes | no | 1 | 0 } [IE5]: Whether it can be resized. The default is no. status: {yes | no | 1 | 0} [IE5]: Whether to display the status bar. Default is yes[Modal] or no[Modal]. scroll:{ yes | no | 1 | 0 | on | off }: Indicates whether the dialog box displays scroll bars. The default is yes. For example: "dialogWidth=200px;dialogHeight=100px" So we can pass values between the two forms through the window.dialogArguments parameter For example, the following two pages: FatherPage.htm:
The above are all about passing values from the parent form to the child form, so how to pass the value from the child form to the parent form? What about passing values through forms? In fact, you can get the value of the subform through window.returnValue. Like window.dialogArguments, window.returnValue can be any variable, including strings, arrays, objects, etc. For example: FatherPage.html: XML-Code:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn