<body>
<div class= "box" >
<select size= "8" id= "Left-select" >
<option value= "" >1</option>
<option value= "" >2</option>
<option value= "" >3</option>
<option value= "" >4</option>
<option value= "" >5</option>
<option value= "" >6</option>
<option value= "" >7</option>
<option value= "" >8</option>
</select>
<br>
<button id= "left_up" > Move Up </button>
<button> Move Down </button>
<button id= "right" > moving to the left </button>
<button id= "Right_all" > All right Shift </button>
</div>
<div class= "box" >
<select size= "8" id= "Right-select" >
<option value= "" >1</option>
<option value= "" >2</option>
<option value= "" >3</option>
<option value= "" >4</option>
<option value= "" >5</option>
<option value= "" >6</option>
<option value= "" >7</option>
<option value= "" >8</option>
</select>
<br>
<button> Move Up </button>
<button> Move Down </button>
<button> Move left </button>
<button> left shift all </button>
</div>
<script src= "./js/Mobile Option.js" ></script>
</body>
JavaScript(function () {
var leftselect = document.getElementById (' Left-select ');
var rightselect = document.getElementById (' Right-select ');
var leftupbtn = document.getElementById (' left_up ');
var rightbtn = document.getElementById (' right ');
var rightallbtn = document.getElementById (' Right_all ');
?
Leftupbtn.onclick = function () {
var index = Leftselect.selectedindex;
//If option is not selected in Select, subsequent operations are not performed
if (index!==-1) {
var option = Leftselect.options[index];
?
if (index = = = 0) {
leftselect.appendchild (option);
} else {
leftselect.insertbefore (option, leftselect.options[index-1]);
}
}
};
?
Rightbtn.onclick = function () {
var index = Leftselect.selectedindex;
if (index!==-1) {
var option = Leftselect.options[index];
?
rightselect.appendchild (option);
}
};
?
Rightallbtn.onclick = function () {
For (var i = 0; i < leftSelect.options.length;) {
Rightselect.appendchild (Leftselect.options[i]);
}
};
})();
Click the button to move the form element around