The script is a simplified version. In general, many CMS have such functions. Selection in dedecms Article This function is also used. The specific Code .
Core code of the parent page:
Copy code The Code is as follows: <SCRIPT>
Function selectarclista (fname ){
VaR posleft = 10;
VaR postop = 10;
Window. Open ("content_select_list.asp? F = "+ fname +" & K = "+ form1.keyword. value, "selarclist", "scrollbars = Yes, resizable = Yes, statebar = No, width = 700, Height = 500, Left =" + posleft + ", top = "+ postop );
}
</SCRIPT>
<Input name = "lsel" type = "button" id = "lsel" class = "NBT" style = "width: 150px "onchange =" "value =" select from published documents... "onclick =" selectarclista ('form1. xiangguanid '); ">
Core code of the sub-page: Copy code The Code is as follows: <script language = JavaScript>
// Obtain the name of the selected file
Function getcheckboxitem ()
{
VaR allsel = "";
If (document. form2.arcid. Value) return document. form2.arcid. value;
For (I = 0; I <document. form2.arcid. length; I ++)
{
If (document. form2.arcid [I]. Checked)
{
If (allsel = "")
Allsel = Document. form2.arcid [I]. value;
Else
Allsel = allsel + "," + document. form2.arcid [I]. value;
}
}
Return allsel;
}
Function selall ()
{
For (I = 0; I <document. form2.arcid. length; I ++)
{
If (! Document. form2.arcid [I]. Checked)
{
Document. form2.arcid [I]. Checked = true;
}
}
}
Function noselall ()
{
For (I = 0; I <document. form2.arcid. length; I ++)
{
If (document. form2.arcid [I]. Checked)
{
Document. form2.arcid [I]. Checked = false;
}
}
}
Function returnvalue ()
{
If(registry.opener.doc ument. form1.xiangguanid. value = ""){
Required parameter opener.doc ument. form1.xiangguanid. value = getcheckboxitem ();
}
Else {
Required parameter opener.doc ument. form1.xiangguanid. Value + = "," + getcheckboxitem ();
}
Alert ("the selected ID is successfully added, you can continue to add ");
// Window. Opener = true;
// Window. Close ();
}
The following is the HTML code. <input type = "checkbox" name = "arcid" value = "<% = RS (" ID ") %>"> output IDCopy codeThe Code is as follows: <a class = inputbutx
Href = "javascript: selall ()"> select all </a> <a class = inputbutx
Href = "javascript: noselall ()"> cancel </a> <a class = inputbutx
Href = "javascript: returnvalue ()"> Add the selected value to the list </a>
The following is a supplement:
// Mode form value passing
<! -- ===== Parent window, I name it parentform.html ====-->Copy codeThe Code is as follows: <! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML>
<Head>
<Title> confirm data input in the pop-up window and return to the parent form-main form </title>
<Meta name = "generator" content = "editplus">
<Meta name = "author" content = "JB 51.net">
<Meta name = "keywords" content = "">
<Meta name = "Description" content = "">
<Script language = "JavaScript" type = "text/JavaScript">
Function doinput ()
{
VaR win = Window. showmodaldialog ("childform.html", window, "dialogwidth = 500px; dialogheight = 300px; center = yes; status = No ");
If (win! = NULL)
{
Document. getelementbyid ("parenttextbox"). value = win;
}
}
</SCRIPT>
</Head>
<Body> input data in the new pop-up form and transfer it to the parent form.
<Br/>
<Br/>
<Br/>
<Input type = "text" id = "parenttextbox"/> <a href = "javascript: doinput ()"> click here to bring up a subform </a>
</Body>
</Html>
<! -- =============== Parent form code end ======================== -->
<! -- ======= Sub-form: named childform.html ======== --> Copy code The Code is as follows: <! Doctype HTML public "-// W3C // dtd html 4.0 transitional // en">
<HTML>
<Head>
<Title> confirm data input in the pop-up window and return it to the parent form-child form </title>
<Meta name = "generator" content = "editplus">
<Meta name = "author" content = "qiujy">
<Meta name = "keywords" content = "">
<Meta name = "Description" content = "">
<Base target = "_ Self">
</Head>
<Body topmargin = "0" leftmargin = "0" scroll = "no">
</BR>
<Input type = "text" id = "childtextbox"/>
</Br> </BR>
<A href = "javascript: dopasstoparent ()"> click here to return </a>
</Body>
</Html>
<Script language = "JavaScript" type = "text/JavaScript">
Document. getelementbyid ("childtextbox"). value = maid. Doc ument. getelementbyid ("parenttextbox"). value;
Function dopasstoparent ()
{
If (document. getelementbyid ("childtextbox"). value. Length <= 0)
{
Alert ("Enter data ");
Return;
}
Window. returnvalue = Document. getelementbyid ("childtextbox"). value;
Window. Close ();
}
</SCRIPT>
// Pass values to the child form and parent form
1. create two pages: parent.html copy Code the code is as follows:
parent form
The other is the subform:Copy codeThe Code is as follows: <! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<HTML xmlns = "http://www.w3.org/1999/xhtml">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> subform </title>
<Script language = "JavaScript" type = "text/JavaScript">
Function closewind (){
Opener. setvalue ("pass value to parent form ");
Window. Close ();
}
</SCRIPT>
</Head>
<Body>
<Form ID = "form1" name = "form1" method = "Post" Action = "">
<Label> disable
<Input type = "button" name = "btn_close" id = "btn_close" value = "button" onclick = "closewind ();"
/>
</Label>
</Form>
</Body>
</Html>
2. Use the setvalue (m_strvalue) of the parent form executed by the child form to perform the value assignment operation.