1. window. showModalDialog (url, args, dialogattrs)
Parameter description:
Url: the url of the pop-up page.
Agrs: parameters passed to the dialog box in the main window, which can be of any type (array or)
Dialogattrs: style parameters in the pop-up window
Mode dialog box usage:
Main window: var value = window. showModalDialog ('test. js', strs, 'resizable: Yes ');
In the pop-up box, use window. returnValue to set the return value. The value obtained above is the value, and you can
This value is processed for interaction.
Note: the application of the mode dialog box lies in its return value. It can return simple escape characters or arrays. The non-mode dialog box is similar
2. Window. open:
Parent window]
Copy codeThe Code is 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.txt 0. value = textValue;
}
Else
{
Window. close ();
Child. close ();
}
}*/
}
</Script>
<A href = "javascript: show_child ();"> open a subwindow </a>
<Form name = frm0>
<Input type = "text" name = "txt0" id = "txt0"> // note that the ID attribute must be written here. Otherwise, the value cannot be obtained under FF.
</Form>
Subwindow]
Copy codeThe Code is 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.doc ument. getElementById ("txt0"). value = document. getElementById ("txt"). value
}
</Script>
<Body>
<Form name = frm>
<Input type = checkbox name = item value = 1 onclick = "choseItem ();">
<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: windows. because there are many user-defined open, windows is used. there are many open pages. Many Web editors prefer showModalDialog. If you don't know which one to use, you can use window. open. Many mature cms systems use Windows. open.