Javascript window. returnvalue usage

Source: Internet
Author: User

Window. the returnvalue usage method returnvalue is the property of the HTML window object in Javascript. The purpose is to return the window value. the showmodaldialog function is used to open an IE mode window (the mode window knows, it means that the parent window cannot be operated after it is opened, and the mode window can only be operated when it is closed) and return the window value,

The following is an example:

1、parent.html HTML code // father.html

<HTML>

<Head>

<Meta name = "generator" content = "Microsoft Visual Studio 6.0">

<Title> </title>

<Script language = "JavaScript">

Function showmodal (){

VaR ret = Window. showmodaldialog ("child.htm", null, "dialogwidth: 350px; dialogheigh T: 350px; help: No; Status: No ");

If (RET ){

Alert ('subwindow returns true! ');

} Else {

Alert ('subwindow returns false! ');

}

}

</SCRIPT>

</Head>

<Body>

<Input id = button1 type = button value = button name = button1 onclick = "showmodal ();">

</Body>

</Html>

2、child.html HTML code // child.html

<HTML>

<Head> <meta name = "generator" content = "Microsoft Visual Studio 6.0">

<Title> </title>

<Script language = "JavaScript">

Function trans (TAG ){

If (TAG = 0 ){

Window. returnvalue = false;

} Else {

Window. returnvalue = true;

} Window. Close ();

}

</SCRIPT>

</Head>

<Body>

<Input id = button1 type = button value = "returns true" name = button1 onclick = "Trans (1)">

<Input id = button2 type = button value = "false" name = button2 onclick = "Trans (0)">

</Body>

</Html>

Summary: in this way, the value can be transferred from the mode window to the parent window. This returnvalue can be a JS array in addition to a Boolean value or an integer value, it is used to transmit a large amount of data.

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.