复制代码代码如下:
<%
昏暗的
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>