<HTML>
<HEAD>
<TITLE>選擇下拉菜單</TITLE>
<META NAME="Description" CONTENT="Power by hill">
<meta http
</HEAD>
<BODY>
<p>選定一項或多項然後點擊添加或移除(按住shift或ctrl可以多選)
<form method="post" name="myform">
<table border="
<tr>
<td width="
<select style="WIDTH:
<option value="北京">北京</option>
<option value="上海">上海</option>
<option value="山東">山東</option>
<option value="安徽">安徽</option>
<option value="重慶">重慶</option>
<option value="福建">福建</option>
<option value="甘肅">甘肅</option>
<option value="廣東">廣東</option>
<option value="廣西">廣西</option>
<option value="貴州">貴州</option>
<option value="海南">海南</option>
<option value="河北">河北</option>
<option value="黑龍江">黑龍江</option>
</select>
</td>
<td width="
<input type="button" value="添加" onclick="moveOption(document
<br/>
<input type="button" value="刪除" onclick="moveOption(document
</td>
<td width="
<select style="WIDTH:
</select>
</td>
<td>
<button onclick="changepos(list
<br/>
<button onclick="changepos(list
</td>
</tr>
</table>
值
</form>
<script language="JavaScript">
function moveOption(e
try{
for(var i=
if(e
var e = e
e
e
ii=i
}
}
document
}
catch(e){}
}
function getvalue(geto){
var allvalue = "";
for(var i=
allvalue +=geto
}
return allvalue;
}
function changepos(obj
{
if(index==
if (obj
obj
}
}
else if(index==
if (obj
obj
}
}
}
</script>
</BODY>
</HTML>
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/20198.html