1.window.showmodaldialog (Url,args,dialogattrs)
Parameter description:
URL: Pop-up page address
AGRs: The main window to the dialog box parameters, can be any type (array can also)
Dialogattrs: Pop-up window style parameters
Modal dialog box usage:
Main window: var value =window.showmodaldialog (' test.jsp ', STRs, ' resizable:yes ');
In the pop-up box, you set the return value by Window.returnvalue, and the value above gets this, and then the main window
This value is processed to enable interactive processing
Note: The modal dialog box is applied in its return value, can return a simple character channeling, can return an array, modeless dialog box similar
2. window.open:
"Parent Window"
Copy Code code as follows:
<script>
function Show_child ()
{
var child=window. Open ("child.html", "Child", "Height=200,width=400,status=yes,toolbar=no,menubar=no,location=no") ;
/* IF (!child.closed)
{
if (!window. Close ())
{
var TextValue = Frm.txt.value; Parent.frm0.txt0.value = TextValue;
}
Else
{
window. close ();
Child.close ();
}
}*/
}
</script>
<a href= "Javascript:show_child ();" > Open child windows </a>
<form name=frm0>
<input type= "text" name= "txt0" id= "txt0" >/Note You must write the id attribute here otherwise FF cannot get the value
</form>
"Child Window"
Copy Code code as follows:
<script>
function Choseitem ()
{
var v= "";
var check_item = Document.frm.item;
for (i=0;i<check_item.length;i++)
{
if (check_item[i].checked)
{
v+= "," +check_item[i].value;
}
Document.frm.txt.value=v.replace (/^,{1}/, "");
}
}
function foo ()
{
window. close ();
window. Opener.document.getElementById ("Txt0"). Value=document.getelementbyid ("TXT"). Value
}
</script>
<body>
<form name=frm>
<input type=checkbox name=item value=1 onclick= "Choseitem ();" >a
<input type=checkbox name=item value=2 onclick= "Choseitem ();" >b
<input type=checkbox name=item value=3 onclick= "Choseitem ();" >c
<input type=checkbox name=item value=4 onclick= "Choseitem ();" >d
<input type=text name= "txt" id= "TXT" >
</form>
<input Type=button value= "Close" "onclick=" foo (); " >
</body>
Summary: Under normal circumstances, windows.open because the custom more, therefore uses windows.open more, above many page editors like to use the ShowModalDialog, really does not know which, Use window.open, many mature CMS systems are used window.open.