HOw?
somehow the add function here won't work![]()
![]()
HTML Code:<html> <head> <script type="text/javascript"> function formAction(choice) { var from, to; var selected; switch(choice){ case 1: from=document.getElementById("myFirstList") to=document.getElementById("mySecondList") alert("event fired first to second") break; case 2: from=document.getElementById("mySecondList") to=document.getElementById("myFirstList") alert("event fired second to first") break; } selected = from.options[from.selectedIndex].text alert(selected) from.remove(from.selectedIndex) to.add(selected); alert(from.length + ", " + to.length) } </script> </head> <body> <form name="anotherform"> <select id="myFirstList" size=4> <option>One</option> <option>Two</option> <option>Three</option> <option>four</option> </select> <input type="button" onclick="formAction(1)" value="FIrst >> SEcond"> <input type="button" onclick="formAction(2)" value="second >> first"> <select id="mySecondList" size=4> </select> </form> </body> </html>





Reply With Quote