Advertisement
Guest User

Untitled

a guest
Jun 26th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Select</title>
  5. </head>
  6. <body>
  7. <select id="lista_izquierda" multiple size="5" id="lista_izquierda">
  8. <option id="1" >Volvo</option>
  9. <option id="2">Mazda</option>
  10. <option id="3">Chevrolet</option>
  11. <option id="4">KIA</option>
  12. <option id="5">Ford</option>
  13. </select>
  14.  
  15. <input type="button" onclick="PasarParametro()" value="PASAR" />
  16. <input type="button" onclick="RegresarParametro()" value="REGRESAR"/>
  17.  
  18. <select id="lista_derecha" multiple size="5" >
  19. </select>
  20. </body>
  21. <script>
  22.  
  23. function PasarParametro(){
  24. obj = document.getElementById('lista_izquierda');
  25. if(obj.selectedIndex == -1){
  26. return;
  27. }
  28. valor = obj.id;
  29. txt = obj.options[obj.selectedIndex].text;
  30.  
  31. obj.options[obj.selectedIndex] = null;
  32.  
  33. obj2 = document.getElementById('lista_derecha');
  34. opc = new Option(txt, valor);
  35.  
  36. eval(obj2.options[obj2.options.length] = opc);
  37. return false;
  38. }
  39. function RegresarParametro(){
  40. obj = document.getElementById('lista_derecha');
  41. if(obj.selectedIndex == -1){
  42. return;
  43. }
  44. valor = obj.id;
  45. txt = obj.options[obj.selectedIndex].text;
  46. obj.options[obj.selectedIndex] = null;
  47. obj2 = document.getElementById('lista_izquierda');
  48. opc = new Option(txt, valor);
  49. eval(obj2.options[obj2.options.length] = opc);
  50. return false;
  51. }
  52. </script>
  53. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement