JavaScript implements a simple example of the value of the parent form _javascript technique

Source: Internet
Author: User

window.showModalDialog () Use method:

var returnvalue = window.showmodaldialog (URL [, arguments] [, features]);

URL-- required parameter, type: string, to specify the URL of the document to display in the dialog box

arguments-- optional parameter, type: Variant, used to pass parameters to the dialog box, pass the parameter type is not limited, including arrays, dialog box through the window.dialogarguments to get the parameters passed in

Features-- optional parameters, type: strings, used to describe the appearance of dialog boxes, and so on, you can use the following one or several, with semicolons ";" Separated

Dialogheight: Dialog box height, not less than 100px
Dialogwidth: Dialog box width
Dialogleft: The distance from the left of the screen
Dialogtop: The distance from the screen
center:{Yes | no | 1 | 0}: Center, default yes, but can still specify height and width
Help:{yes | no | 1 | 0}: Show Help button, default Yes
Resizable:{yes | no | 1 | 0} [ie5+]: Can be changed size, default No
Status:{yes | no | 1 | 0} [ie5+]: Show status bar, default to yes[Modeless] or No[modal]
scroll:{Yes | no | 1 | 0 | on | off}: Scroll bar is displayed, default is Yes

Parameter passing:

1. To pass arguments to the dialog box, it is passed through the arguments, the type is not limited, for the string type, the maximum is 4,096 characters, you can also pass the object, for example:
Parent.htm

Copy Code code as follows:

<script>

var obj = new Object ();

Obj.name= "justflyhigh.com";

window.showModalDialog ("modal.htm", obj, "dialogwidth=200px;dialogheight=100px");

</script>


Modal.htm
Copy Code code as follows:

<script>
var obj = window.dialogarguments;
Alert ("The parameter you passed is:" + obj.name)
</script>

2. You can return information by Window.returnvalue to the window that opens the dialog box, or you can also be an object, for example:

Parent.htm

Copy Code code as follows:

<script>
var result =window.showmodaldialog ("modal.htm", "dialogwidth=200px;dialogheight=100px");
alert (result);
</script>

Modal.htm
Copy Code code as follows:

<script>
Window.returnvalue= "Http://www.jb51.net";
</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.