<!DOCTYPE HTML><HTML><Head><title>CheckBox Practice</title><Metahttp-equiv= "keywords"content= "Keyword1,keyword2,keyword3"><Metahttp-equiv= "description"content= "This is my page"><Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8"><Scripttype= "Text/javascript">window.onload= function() { /*about feature implementation 1. How can I move one item on the left to the right? How do I get the selected item in select? select.options;----get an array of all the option. Select has a property called Selectindex. Gets the index of the selected item. var Option=select.options[select.selectindex]----Get the selected item. Rightselect.add (option); */ //move one to the right.document.getElementById ("removerightonly"). onclick= function() { //gets the item selected in the left select. var Left=document.getElementById (" Left"); //get the Select on the left varoption=Left.options[left.selectedindex];//get the item selected on the left.document.getElementById (" Right"). Add (option); }; /*2. How to move the left to the right of all movements. The options get all, make all of them, use Rightselect.add to add all to the right. */document.getElementById ("Removerightall"). onclick= function() { //get all the left var Left=document.getElementById (" Left"); varOps=left.options;//get all the option on the left //iterate through each option and add it to the right. while(Ops.length>0) {document.getElementById (" Right"). Add (ops[0]); } }; }</Script></Head><Body> <TableAlign= ' Center '> <TR> <TD><Selectsize= "Ten"ID= "Left"> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> <option>Option 4</option> <option>Option 5</option> <option>Option 6</option> <option>Option 7</option> <option>Option 8</option> <option>Option 9</option> </Select></TD> <TD><inputtype= "button"value= "--->"ID= "Removerightonly"><BR> <inputtype= "button"value= "===>"ID= "Removerightall"><BR> <inputtype= "button"value= "<---"ID= "Removeleftonly"><BR> <inputtype= "button"value= "<==="ID= "Removeleftall"><BR> </TD> <TD><Selectsize= "Ten"ID= "Right"> <option>Option 10</option> </Select></TD> </TR> </Table></Body></HTML>
Select box Move Right-html