Click the input box to pop up the selection box. js script

Source: Internet
Author: User

<! 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>
<Title> click the input box to display the selection box.

Http://www.zzsky.cn/effect/content/2355.htm

</Title>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312">
<! -- Add the following code between <Style type = "text/CSS">
. Black_overlay {display: none; position: absolute; top: 0%; left: 0%; width: 100%; Height: 100%; Background-color: # ffffff; Z-index: 1001; -Moz-opacity: 0.8; opacity :. 80; filter: alpha (opacity = 80 );}
. White_content {display: none; position: absolute; top: 25%; left: 25%; width: 50%; Height: 50%; padding: 16px; Border: 16px solid orange; margin: -32px; Background-color: White; Z-index: 1002; overflow: auto ;}
</Style>
<Script language = "JavaScript" type = "text/JavaScript">
Function moveselect (OBJ, target, all ){
If (! All) All = 0
If (OBJ! = "[Object]") OBJ = eval ("document. All." + OBJ)
Target = eval ("document. All." + target)
If (all = 0)
{
While (obj. selectedindex>-1 ){
// Alert (obj. selectedindex)
Mot = obj. Options [obj. selectedindex]. Text
MoV = obj. Options [obj. selectedindex]. Value
OBJ. Remove (obj. selectedindex)
VaR newoption = Document. createelement ("option ");
Newoption. Text = mot
Newoption. value = mov
Target. Add (newoption)
}
}
Else
{
// Alert (obj. options. length)
For (I = 0; I <obj. length; I ++)
{
Mot = obj. options [I]. text
Mov = obj. options [I]. value
Var newoption = document. createElement ("OPTION ");
Newoption. text = mot
Newoption. value = mov
Target. add (newoption)
}
Obj. options. length = 0
}
}
Function dakai (){
Document. getElementById ('light '). style. display = 'block ';
Document. getElementById ('fade '). style. display = 'block'
}
Function guanbi (){

 

// Upload the select value on the right to the text box below
Var yuanGong = document. getElementById ("yuanGong ")

VaR yuangongname = Document. getelementbyid ("yuangongname ");
Yuangongname. value = "";

Yuangong. value = "" // if this sentence is not added, the result of each selection is appended.
VaR huoqu = Document. getelementbyid ("D2 ")
For (var k = 0; k {
Yuangong. value = yuangong. Value + huoqu. Options [K]. Value + "" // here "is a space in the middle. It is a delimiter between characters and can be changed to another

If (yuangongname. value = "")
{
Yuangongname. value = yuangongname. Value + huoqu. Options [K]. Text; // The "" Here is a space in the middle. It is a delimiter between characters and can be changed to another

}
Else
{
Yuangongname. value = yuangongname. Value + "," + huoqu. Options [K]. Text; // The "" Here is a space in the middle. It is a delimiter between characters and can be changed to another

}

}

Document. getelementbyid ('light '). style. Display = 'none ';
Document. getelementbyid ('fade '). style. Display = 'none'
}
</SCRIPT>
</Head>
<Body>
<! -- Add the following code to the <body> and </body> -->
<Input type = "text" id = "yuanGong" onclick = "dakai ()" size = "50">

<Input type = "text" id = "yuanGongname" size = "50">

<Div id = "light" class = "white_content">
<Table border = "1" width = "350" id = "table4" bordercolor = "# CCCCCC" bordercolordark = "# CCCCCC" bordercolorlight = "# FFFFFF" cellpadding = "3" cellspacing = "0">
<Tr>
<Td width = "150" height = "200" align = "center" valign = "middle">
Employees of this department
<Select size = "12" name = "D1" ondblclick = "moveselect (this, 'd2 ')" multiple = "multiple" style = "width: 140px">
<Option value = "1"> EMPLOYEE 1 </option>
<Option value = "2"> EMPLOYEE 2 </option>
<Option value = "3"> employee 3 </option>
</SELECT>
</TD>
<TD width = "50" Height = "200" align = "center" valign = "Middle">
<Input type = "button" value = "<" name = "B3" onclick = "moveselect ('d2 ', 'd1', 1)"> <br>
<Input type = "button" value = "<" name = "B5" onclick = "moveselect ('d2 ', 'd1')"> <br>
<Input type = "button" value = ">" name = "B6" onclick = "moveselect ('d1 ', 'd2')"> <br>
<Input type = "button" value = ">" name = "B4" onclick = "moveselect ('d1 ', 'd2', 1)"> <br>
</Td>
<Td width = "150" height = "200" align = "center" valign = "middle">
Undivided Department employees
<Select size = "12" name = "D2" id = "D2" ondblclick = "moveselect (this, 'd1 ')" multiple = "multiple" style = "width: 140px ">
<Option value = "4"> employee 4 </option>
<Option value = "5"> employee 5 </option>
</Select>
</Td>
</Tr>
</Table>
<A href = "javascript: void (0)" onclick = "guanbi ()"> OK </a>
<Input type = "button" name = "button" onclick = "guanbi ()" value = "You can also use the button to determine">
</Div>
<Div id = "Fade" class = "black_overlay"> </div>
</Body>
</Html>
</Body>
</Html>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.