这样实现 是 ASP 写的
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function addList(){
var thelist=document.form1.leftlist;
var theText=document.form1.theText.value;
var theValue=document.form1.theValue.value;
var theOption=new Option(theText,theValue);
var thePostion=thelist.options.length;
thelist.options[thePostion] =theOption;
}
function movlist(a,b){
var folist=document. form1.elements[a];
var tolist=document. form1.elements[b];
var theNum= folist.options.selectedIndex;
while(theNum>=0){ var theText=folist.options[theNum].text;
var theValue=folist.options[theNum].value;
var newOption=new Option(theText,theValue);
var theNum2=tolist.options.length; tolist.options[theNum2]=newOption;
folist.options[theNum]=null;
theNum=folist.options.selectedIndex; }}
function delLlis(){
var theForm=document.form1; var formNum1=theForm.leftlist.options.selectedIndex;
if(formNum1>=0){
theForm.leftlist.options[formNum1]=null;
}
var formNum2=theForm.rightlist.options.selectedIndex;
if(formNum2>=0){
theForm.rightlist.options[formNum2]=null;
}
}
</script></head><body>
<form id="form1" name="form1" method="post">
<table width="353" border="1" align="center">
<tr>
<td width="167" align="center" valign="top"><select name="leftlist" size="10" multiple="MULTIPLE">
<option value="11">aaaa</option>
<option value="22">bbb</option>
<option value="333">ccc</option>
<option value="444">dddd</option>
<option value="5555">eeeee</option>
</select></td>
<td colspan="2"><p>
<input name="Submit2" type="button" value=">>"
onclick="movlist('leftlist','rightlist')"/>
</p>
<p> </p>
<p>
<input name="Submit3" type="button" value="<<" onclick="movlist('rightlist','leftlist')"/>
</p></td>
<td width="181" align="center"><p>
<select name="rightlist" size="10" multiple="multiple" >
</select>
</p> </td>
</tr>
<tr>
<td colspan="2" align="center"><p>标签
</p>
<p>
<input name="theText" type="text" maxlength="10" />
</p></td>
<td colspan="2" align="center"><p>值
</p>
<p>
<input name="theValue" type="text" maxlength="10" />
</p></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="button" name="Submit" value="添加" onclick="addList()"/>
<td align="center"> <input type="button" name="Submit4" value="删除" onclick="delLlis()"/></td>
</tr>
</table>
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<script language="javascript">
function addList(){
var thelist=document.form1.leftlist;
var theText=document.form1.theText.value;
var theValue=document.form1.theValue.value;
var theOption=new Option(theText,theValue);
var thePostion=thelist.options.length;
thelist.options[thePostion] =theOption;
}
function movlist(a,b){
var folist=document. form1.elements[a];
var tolist=document. form1.elements[b];
var theNum= folist.options.selectedIndex;
while(theNum>=0){ var theText=folist.options[theNum].text;
var theValue=folist.options[theNum].value;
var newOption=new Option(theText,theValue);
var theNum2=tolist.options.length; tolist.options[theNum2]=newOption;
folist.options[theNum]=null;
theNum=folist.options.selectedIndex; }}
function delLlis(){
var theForm=document.form1; var formNum1=theForm.leftlist.options.selectedIndex;
if(formNum1>=0){
theForm.leftlist.options[formNum1]=null;
}
var formNum2=theForm.rightlist.options.selectedIndex;
if(formNum2>=0){
theForm.rightlist.options[formNum2]=null;
}
}
</script></head><body>
<form id="form1" name="form1" method="post">
<table width="353" border="1" align="center">
<tr>
<td width="167" align="center" valign="top"><select name="leftlist" size="10" multiple="MULTIPLE">
<option value="11">aaaa</option>
<option value="22">bbb</option>
<option value="333">ccc</option>
<option value="444">dddd</option>
<option value="5555">eeeee</option>
</select></td>
<td colspan="2"><p>
<input name="Submit2" type="button" value=">>"
onclick="movlist('leftlist','rightlist')"/>
</p>
<p> </p>
<p>
<input name="Submit3" type="button" value="<<" onclick="movlist('rightlist','leftlist')"/>
</p></td>
<td width="181" align="center"><p>
<select name="rightlist" size="10" multiple="multiple" >
</select>
</p> </td>
</tr>
<tr>
<td colspan="2" align="center"><p>标签
</p>
<p>
<input name="theText" type="text" maxlength="10" />
</p></td>
<td colspan="2" align="center"><p>值
</p>
<p>
<input name="theValue" type="text" maxlength="10" />
</p></td>
</tr>
<tr>
<td colspan="3" align="center"><input type="button" name="Submit" value="添加" onclick="addList()"/>
<td align="center"> <input type="button" name="Submit4" value="删除" onclick="delLlis()"/></td>
</tr>
</table>
</form>
</body>
</html>
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货