The value passing problem of the modal type.

Source: Internet
Author: User

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.

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.