Paste2 Logo
  1.        var leftlist ;
  2.         var rightlist ;
  3.  
  4. function init()
  5. {
  6. if(document.getElementById('left')){
  7.          leftlist = document.getElementById('left');
  8.          rightlist = document.getElementById('right');
  9.        
  10. }
  11.  
  12. }
  13. function toLeft()
  14. {
  15.  init();
  16. var newOption = document.createElement('option');
  17. newOption.setAttribute('value', rightlist.item(rightlist.selectedIndex).getAttribute("value"));
  18. newOption.text=rightlist.item(rightlist.selectedIndex).text;
  19. leftlist.appendChild(newOption);
  20. rightlist.remove(rightlist.selectedIndex);
  21.        
  22. }
  23. function toRight()
  24. {
  25.      init();
  26. var newOption = document.createElement('option');
  27. newOption.setAttribute('value', leftlist.item(leftlist.selectedIndex).getAttribute("value"));
  28. newOption.text=leftlist.item(leftlist.selectedIndex).text;
  29.         rightlist.appendChild(newOption);
  30.         leftlist.remove(leftlist.selectedIndex);
  31. }
  32.