SHARE
TWEET

Untitled

a guest Apr 18th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <body>
  4.  
  5. <select id="select" size="8">
  6.   <option value="volvo">Volvo</option>
  7.   <option value="saab">Saab</option>
  8.   <option value="opel">Opel</option>
  9. </select>
  10.  
  11. <button onclick="levo();">Levo</button>
  12. <button onclick="desno();">Desno</button>
  13.  
  14. <select id="select2" size="8">
  15.   <option value="audi">Audi</option>
  16. </select>
  17.  
  18. <script>
  19. function desno() {
  20.   var select = document.getElementById("select");
  21.   var select2 = document.getElementById("select2");
  22.   var option = document.createElement("option");
  23.   var index = select.selectedIndex;
  24.   option.text=select.options[index].innerHTML;
  25.   select.remove(index);
  26.   select2.add(option);
  27. }
  28.  
  29. function levo() {
  30.   var select = document.getElementById("select");
  31.   var select2 = document.getElementById("select2");
  32.   var option = document.createElement("option");
  33.   var index = select2.selectedIndex;
  34.   option.text=select2.options[index].innerHTML;
  35.   select2.remove(index);
  36.   select.add(option);
  37. }
  38. </script>
  39. </body>
  40. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top