How to Select, remove, and exchange multiple items from the js Select drop-down list box

Source: Internet
Author: User

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">
<Span class = 'wp _ keywordlink_affiliate '> <a href = "tag/html" title = "view all articles in html" target = "_ blank"> html </a> </span> 4/loose. dtd ">
<Span class = 'wp _ keywordlink_affiliate '> <a href = "tag/html" title = "view all articles in html" target = "_ blank"> html </> </span>
<Head>
<Title> Select drop-down list box for multiple selections, removal, and content exchange </title>
<Meta http-equiv = "Content-Type" content = "text/<span class = 'wp _ keywordlink_affiliate '> <a href =" tag/html "title =" view html all the articles in "target =" _ blank "> html </a> </span>; charset = gb2312 ">
</Head>
<Body style = "font-size: 12px">
<Form name = "form1" method = "post" action = "">
<Table width = "380" border = "0" align = "center" cellpadding = "0" cellspacing = "0">
<Tr>
<Td width = "150"> <table width = "150" border = "0" cellpadding = "1" cellspacing = "1" bgcolor = "# CAFAFC">
<Tr>
<Td height = "25" background = "wp-content/uploads/2012/05/79760-772704496-8.gif" bgcolor = "# FFFFFF"> select: </td>
</Tr>
<Tr>
<Td align = "center" bgcolor = "# FFFFFF"> <select name = "sel_place1" size = "6" multiple id = "sel_place1" style = "width: 100px">
<Option value = "sel1"> Jiangsu </option>
<Option value = "sel2"> Guangdong </option>
<Option value = "sel3"> Henan </option>
<Option value = "sel4"> Jilin Province </option>
<Option value = "sel5"> Zhejiang </option>
</Select> </td>
</Tr>
</Table> </td>
<Td width = "80" align = "center" valign = "bottom"> <input name = "sure1" type = "button" id = "sure1"
OnClick = "allsel (document. form1.sel _ place2, document. form1.sel _ place1);" value = "<">

<Input name = "sure2" type = "button" id = "sure2"
OnClick = "allsel (document. form1.sel _ place1, document. form1.sel _ place2);" value = ">" align = "center" height = "2"> </td>
<Td width = "150"> <table width = "150" border = "0" cellpadding = "1" cellspacing = "1" bgcolor = "# CAFAFC">
<Tr>
<Td height = "25" background = "wp-content/uploads/2012/05/79760-772704496-8.gif" bgcolor = "# FFFFFF"> select: </td>
</Tr>
<Tr>
<Td align = "center" bgcolor = "# FFFFFF"> <select name = "sel_place2" size = "6" multiple id = "sel_place2" style = "width: 100px">
</Select> </td>
</Tr>
</Table> </td>
</Tr>
</Table>
</Form>
<Script language = "javascript">
Function allsel (n1, n2)
{
While (n1.selectedIndex! =-1)
{
Var indx = n1.selectedIndex;
Var t = n1.options [indx]. text;
N2.options. add (new Option (t ));
N1.remove (indx );
}
}
</Script>
</Body>
</Html> </td>
</Tr>
</Table>

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.