複製代碼代碼如下:
<%
昏暗的
a = split(request.form(“ oilcelist”),“,”)
response.write“ source:”&request.form(“ sourcelist”)&ubound(a)&“ <br>對象:”&request.form(“ objectList”)&“ <br>”
%>
<html>
<頭>
<meta http-equiv =“ content-type” content =“ text/html; charset = gb2312”>
<title>無標題文檔</title>
<樣式類型= text/css>
.bgsubleft {
背景位置:中心底部;背景圖像:URL(Images/bgleft.gif);背景重複:重複X
}
.bgsubleftn {
背景位置:左下角;背景圖像:URL(圖像/bgleftn.gif);背景重複:無重複
}
</style>
<腳本語言=“ javascript” type =“ text/javaScript”>
函數addSelectedList()
{
var objsource = form1.sourcelist;
var objobject = form1.ObjectList;
var sourcelen = objsource.length;
for(var i = 0; i <sourcelen; i ++){
if(objsource.options [i] .selected){
如果(!checkexist(objobject,objsource.options [i] .value)){
addtolist(objobject,objsource.options [i] .text,objsource.options [i] .value);
}
}
}
}
函數addalllist()
{
var objsource = form1.sourcelist;
var objobject = form1.ObjectList;
var sourcelen = objsource.length;
for(var i = 0; i <sourcelen; i ++){
如果(!checkexist(objobject,objsource.options [i] .value)){
addtolist(objobject,objsource.options [i] .text,objsource.options [i] .value);
}
}
}
函數removeselectedList(noremoveValue)
{
var objobject = form1.ObjectList;
for(var i = 0; i <objobject.length; i ++){
if(objobject.options [i] .selected && objobject.options [i] .value!= noremovevalue)
{
objobject.options.remove(i);
撤離者(NoremoveValue);中斷;
}
}
}
函數removeAlllist(noremoveValue)
{
var objobject = form1.ObjectList;
var objlen = objobject.length;
for(var i = 0; i <objlen; i ++){
if(objobject.options [i] .value!= noremoveValue){
objobject.options.remove(i);
removeAlllist(NoremoveValue);突破;
}
}
}
選定功能(OBJ)
{
for(var i = 0; i <obj.length; i ++){
obj.options [i] .selected = true;
}
}
功能Checkexist(obj,value)
{
var isexist = false;
for(var i = 0; i <obj.length; i ++){
if(obj.options [i] .value == value){
isexist = true;
休息;
}
}
返回ISEXIST;
}
函數addtolist(obj,value,label){
obj.add(新選項(value,label));
}
</script>
</head>
<身體bgcolor =“#ffffff”>
<form name =“ form1” action =“ temp.asp” method =“ post”>
<table cellspacing =“ 0” cellpadding =“ 0”>
<tr>
<td> <select name =“ sourcelist” size =“ 10”多ID =“ Sourcelist”>
<option value =“ a”> 1 </option>
<option value =“ b”> 2 </option>
<option value =“ c”> 3 </option>
<%
i = 6至20
response.write(“ <option value =”“”&i+200&“”>“&i+200&” </option>“&vbcrlf)
下一個
%>
</select> </td>
<td> <input name =“ add” type =“ button” id =“ add” value =“ add” onclick =“ addSelectedlist()”> <br>
<input name =“ add” type =“ button” id =“ add” value =“添加” onclick =“ addalllist()”> <br>
<input name =“ add” type =“ button” id =“ add” value =“ remove” onclick =“ removeselectedlist('a')”> <br>
<input name =“ add” type =“ button” id =“ add” value =“ remover” of onclick =“ removeAlllist('a'')”>
<input name =“ add” type =“ button” id =“ add” value =“ select of of onclick =” selectedall(form1.ObjectList)> </td>> </td>
<td> <select name =“ objectList” size =“ 10”多ID =“ ObjectList”>
<option value =“ a”> 1 </option>
<option value =“ d”> 4 </option>
<option value =“ e”> 5 </option>
<%
i = 6至20
response.write(“ <option value =“”“”&i&“”“>”&i&“ </option>”&vbcrlf)
下一個
%>
</select> </td>
</tr>
<tr>
<td> </td>
<td> <input name =“ type” type =“ submit” value =“ submit”> </td>
<td> </td>
</tr>
</table>
</form>
</body>
</html>