Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <body>
- <select id="select" size="8">
- <option value="volvo">Volvo</option>
- <option value="saab">Saab</option>
- <option value="opel">Opel</option>
- </select>
- <button onclick="levo();">Levo</button>
- <button onclick="desno();">Desno</button>
- <select id="select2" size="8">
- <option value="audi">Audi</option>
- </select>
- <script>
- function desno() {
- var select = document.getElementById("select");
- var select2 = document.getElementById("select2");
- var option = document.createElement("option");
- var index = select.selectedIndex;
- option.text=select.options[index].innerHTML;
- select.remove(index);
- select2.add(option);
- }
- function levo() {
- var select = document.getElementById("select");
- var select2 = document.getElementById("select2");
- var option = document.createElement("option");
- var index = select2.selectedIndex;
- option.text=select2.options[index].innerHTML;
- select2.remove(index);
- select.add(option);
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement