window.showModalDialog is the method to pop up the mode window
returnValue is the property of the html window object in javascript. The purpose is to return the window value. When using the window.showModalDialog function to open an IE mode window (you know the mode window, that is, the parent window cannot be operated after opening, and it can only be operated when the mode window is closed), it is used to return the window value. Here is an example:
1. parent.html
//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;dialogHeight:350px;help:no;status:no"); if (ret){alert('Sub-Window Returns True!'); }else{ alert('Sub-Window Returns False!'); } } </script> </HEAD> <BODY> <INPUT id=button1 type=button value=Button name=button1 onclick="showmodal();"> </BODY> </HTML>2. child.html
//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="Return true" name=button1 onclick="trans(1)"> <INPUT id=button2 type=button value="Return false" name=button2 onclick="trans(0)"> </BODY> </HTML>Summarize:
In this way, the function of passing values from the mode window to the parent window can be realized. In addition to being a boolean value, an integer value, etc., this returnValue can also be a js array, which is used to pass a large amount of data.
For specific usage of showModalDialog, please refer to msdn.