Jquery enables left and right movement of select multiple selection boxes

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>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gb2312"/>
<Title> untitled document </title>
<Script type = "text/javascript" src = "jquery-1.4.4.min.js"> </script>
<Script type = "text/javascript">
/**
* Dynamically create options for the drop-down list on the left
* Dynamic creation options for reading data from the database
*/
$ (Document). ready (function (){
For (var I = 1; I <= 5; I ++)
{
$ ("# Fb_list"). append ("<option value = '" + I + "'> Public Bidding for minicomputer procurement 00" + I + "</option> ");
}
})
$ (Function (){
$ ("# Add"). click (function (){
If ($ ("# fb_list option: selected"). length> 0)
{
$ ("# Fb_list option: selected"). each (function (){
$ ("# Select_list "). append ("<option value = '" + $ (this ). val () + "'>" + $ (this ). text () + "</option ");
$ (This). remove ();
})
}
Else
{
Alert ("select the package to be added! ");
}
})
})
$ (Function (){
$ ("# Delete"). click (function (){
If ($ ("# select_list option: selected"). length> 0)
{
$ ("# Select_list option: selected"). each (function (){
$ ("# Fb_list "). append ("<option value = '" + $ (this ). val () + "'>" + $ (this ). text () + "</option ");
$ (This). remove ();
})
}
Else
{
Alert ("select the subcontract to delete! ");
}
})
})
</Script>
</Head>
 
<Body>
<Table width = "95%" cellpadding = "0" align = "center" class = "listshow" border = "1" cellspacing = "0">
<Tr>
<Td colspan = "4" align = "center"> select subcontracting </td>
</Tr>
<Tr>
<Td class = "black" width = "30%" align = "center" height = "150">
<Select id = "fb_list" multiple = "multiple" style = "text-align: center; width: 300px; height: 150px;"> </select>
</Td>
<Td align = "center" width = "5%">
<Input type = "button" id = "add" value = "add www.2cto.com>"/>
<Br/>
<Br/>
<Input type = "button" id = "delete" value = "<delete"/>
</Td>
<Td class = "black" width = "30%" align = "center">
<Select id = "select_list" multiple = "multiple" style = "text-align: center; width: 300px; height: 150px;"> </select>
</Td>
</Tr>
</Table>
</Body>
</Html>

From xinghui_liu's column

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.