1.有左右两个框,中间4个按钮
2.两个框的内容可以互相添加到并移除
1.[代码][JavaScript]代码
左右互移input {
width: 100px;
height: 25px;
}
function move(opertion) {
var leftselect = window.document.getElementById("leftsel");
var rightselect = window.document.getElementById("rightsel");
if (opertion == "addall>>") {
while (leftselect.options.length > 0) {
var delElem = leftselect.removeChild(leftselect.options[0]);
rightselect.appendChild(delElem);
}
} else if (opertion == "<
while (rightselect.options.length > 0) {
var delElem = rightselect.removeChild(rightselect.options[0]);
leftselect.appendChild(delElem);
}
} else if (opertion == "add>") {
while (leftselect.selectedIndex != -1) {
var delElem = leftselect
.removeChild(leftselect.options[leftselect.selectedIndex]);
rightselect.appendChild(delElem);
}
} else{
while (rightselect.selectedIndex != -1) {
var delElem = rightselect
.removeChild(rightselect.options[rightselect.selectedIndex]);
leftselect.appendChild(delElem);
}
}
}
style="height: 300px; width: 150px;" id="leftsel"> 河南 河北 陕西 山西 | style="height: 300px; width: 150px;" id="rightsel"> | |
value="addall>>"> | ||
value=" | ||
value="< |
2.[图片] QQ截图20140807212715.png