The value passing problem of the modal type.
What is modal?
Once a modal window or dialog box is displayed, if you do not operate it (such as clicking OK or cancel), you can perform other operations.
The statements in the pop-up mode window are as follows:
var testSend = window.showModalDialog('modal.htm','','dialogHeight:150px;dialogWidth:500px;center:no');
Window. showModelessDialog (sURL [, vArguments] [, sFeatures])
1) sURL specifies the URL address of the modal window
2) vArguments passing Parameters
3) the appearance and size of the sFeatures window
The first and third parameters must be available.
How do I pass a value?
Close the window and return the value.
Page A js
Function test () {alert ("ID:" + window. dialogArguments. id + ";" + "name:" + window. dialogArguments. name); var message = {"state": "begin", "info": "404"}; window. returnValue = message ;}
Page B js
Function test () {var person = {"id": "001", "name": "yangyang"}; var testSend = Invalid parameter showmodaldialog('modal.htm', person, 'dialogheight: 150px; dialogWidth: 500px; center: no'); alert ("status:" + testSend. state + ";" + "information:" + testSend.info );}
Click OK on page B to pass the value of page.
Close page B and pass the value of page B to page.
Parameter description:
Window. dialogArguments to get the passed parameters.
Window. returnValue returns information to the window that opens the dialog box.
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.