Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title>Select</title>
- </head>
- <body>
- <select id="lista_izquierda" multiple size="5" id="lista_izquierda">
- <option id="1" >Volvo</option>
- <option id="2">Mazda</option>
- <option id="3">Chevrolet</option>
- <option id="4">KIA</option>
- <option id="5">Ford</option>
- </select>
- <input type="button" onclick="PasarParametro()" value="PASAR" />
- <input type="button" onclick="RegresarParametro()" value="REGRESAR"/>
- <select id="lista_derecha" multiple size="5" >
- </select>
- </body>
- <script>
- function PasarParametro(){
- obj = document.getElementById('lista_izquierda');
- if(obj.selectedIndex == -1){
- return;
- }
- valor = obj.id;
- txt = obj.options[obj.selectedIndex].text;
- obj.options[obj.selectedIndex] = null;
- obj2 = document.getElementById('lista_derecha');
- opc = new Option(txt, valor);
- eval(obj2.options[obj2.options.length] = opc);
- return false;
- }
- function RegresarParametro(){
- obj = document.getElementById('lista_derecha');
- if(obj.selectedIndex == -1){
- return;
- }
- valor = obj.id;
- txt = obj.options[obj.selectedIndex].text;
- obj.options[obj.selectedIndex] = null;
- obj2 = document.getElementById('lista_izquierda');
- opc = new Option(txt, valor);
- eval(obj2.options[obj2.options.length] = opc);
- return false;
- }
- </script>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement