java script两个列表之间移动数据
<select name="b1" id="hao" style="width:100px; height:200px;" size="8">
<option>左1 </option>
<option> 左2</option>
<option > 左3</option>
</select>
<input type="button" name="xiangzuo" id="zuo" value="》" onclick="zuo()" size="8"/>
<input type="button" name="xiangyou" id="you" value="《"/ onclick="you()" size="8"/>
<select name="b2" id="buhao" style="width:100px; height:200px;" size="8">
<option >右1 </option>
<option > 右2</option>
<option> 右3</option>
</select>
<script>
function zuo()
{
var op=document.getElementById("hao").selectedOptions;
document.getElementById("buhao").appendChild(op[0]);
document.getElementById("hao").removeChild(op[0]);
}
function you(){
var op=document.getElementById("buhao").selectedOptions;
document.getElementById("hao").appendChild(op[0]);
document.getElementById("buhao").removeChild(op[0]);
}
</script>