<head>
<title>用web实现点菜</title>
<script type="text/javascript">
function move(obj1,obj2){
for (var i = 0; i < obj1.options.length; i++) {
if (obj1.options[i].selected) {
obj2.options.add(new Option(obj1.options[i].text, obj1.options[i].value));
obj1.remove(i);
}
}
}
function ToRight(){
var left = document.getElementById("selLeft");
var right = document.getElementById("selRight");
move(left,right);
}
function ToLeft(){
var right = document.getElementById("selRight");
var left = document.getElementById("selLeft");
move(right,left);
}
</script>
</head>
<body>
<select id="selLeft" multiple="multiple" style="100px; height:150px;">
<option>鱼香肉丝</option>
<option>西红柿炒蛋</option>
<option>千张肉丝</option>
<option>啤酒鸭</option>
</select>
<input type="button" value="-->" onclick=" ToRight();" />
<input type="button" value="<--" onclick=" ToLeft();" />
<select id="selRight" multiple="multiple" style="100px; height:150px;"></select>
</body>