Window. showModalDialog application, showmodaldialog

Source: Internet
Author: User

Window. showModalDialog application, showmodaldialog

1. parameter transfer
VArguments is used to pass parameters. The type is unlimited. For string types, the maximum value is 4096 characters. You can also pass objects.

Example:
A.htm

<Script> window. showModalDialog ("B .htm", "This is a parameter value", "help: no; scroll: no"); </script>

B .htm

<Script> alert ("the value passed through interface A is:" + window. dialogArguments); </script>

2. Return Value
You can use window. returnValue to return information to the parent window (that is, to open the modal window) or an object.

Example:
A.htm

<script>    result=window.showModalDialog("B.htm","","help:no;scroll:no");    alert(result);</script>

B .htm

<Script> window. returnValue = "store returned results here"; </script>

3. Prevent opening a new window after submission in the modal window

Before <body> on the page, add

<base target="_self">

4. Call the parent window method and PASS Parameters

A.htm

<Script> function show () {// method of the a window alert ("show");} var arg = new Object (); // The parameter arg to be passed. win = window; // input the reference of window A as the parameter into arg. str = "argument"; // other parameters to be passed in window. showModalDialog ("B .htm", arg, 'help: no'); </script>

B .htm

<Script> var arg = window. dialogArguments; alert (arg. str); arg. win. show (); // call the method of window A </script>

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.