Directly use the code, which can be used in some places:
Copy codeThe Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<Meta name = "Generator" CONTENT = "EditPlus">
<Meta name = "Author" CONTENT = "">
<Meta name = "Keywords" CONTENT = "">
<Meta name = "Description" CONTENT = "">
<Script language = "JavaScript">
<! --
Function selectValue (){
Window. open ("sub.html", "", "status: no; resizable: yes; dialogHeight: pixel PX; dialogWidth: 460px; unadorne: yes ")
}
// -->
</SCRIPT>
</HEAD>
<BODY>
Text: <input type = "text" name = "testInput"/> <br>
<Input type = "button" onclick = "selectValue ()" value = "select"/>
</BODY>
</HTML>
The sub.html Page code is
Copy codeThe Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.0 Transitional // EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<Meta name = "Generator" CONTENT = "EditPlus">
<Meta name = "Author" CONTENT = "">
<Meta name = "Keywords" CONTENT = "">
<Meta name = "Description" CONTENT = "">
<Script language = "JavaScript">
<! --
Function selectValues (){
Var obj = document. getElementsByName ("temp ");
Var value = "";
For (var I = 0; I <obj. length; I ++ ){
If (obj [I]. checked = true)
Value + = obj [I]. value;
}
Optional values opener.doc ument. all. testInput. value = value;
Window. close ();
}
// -->
</SCRIPT>
</HEAD>
<BODY>
<Input type = "checkbox" name = "temp" value = "A"/> A <br>
<Input type = "checkbox" name = "temp" value = "B"/> B <br>
<Input type = "checkbox" name = "temp" value = "C"/> C <br>
<Input type = "checkbox" name = "temp" value = "D"/> D <br>
<Input type = "button" value = "OK" onclick = "selectValues ()"/>
</BODY>
</HTML>