复制代码代码如下:
<%
atenuar
a = Split (request.form ("Sourcelist"), ",")
Response.Write "Fuente:" & request.form ("Sourcelist") & Ubound (a) & "<br> Object:" & request.form ("ObjectList") y "<br>"
%>
<html>
<Evista>
<meta http-oquiv = "content-type" content = "text/html; charset = gb2312">
<title> Documento sin título </title>
<Estilo type = text/css>
.bgsubleft {
Posición de fondo: fondo central; IMAGEN DE BUENGE: URL (Images/bgleft.gif); Repeat de fondo: repetir-x
}
.bgsubleftn {
Posición de fondo: fondo izquierdo; IMAGEN DE BUENTE: URL (Images/bgleftn.gif); Repeat de fondo: sin repetición
}
</style>
<script language = "javaScript" type = "text/javaScript">
función addSelectedList ()
{
var objSource = form1.sourcelist;
var objobject = form1.objectList;
var Sourcelen = objsource.length;
para (var i = 0; i <sourcelen; i ++) {
if (objsource.options [i] .selected) {
if (! checkexist (objobject, objsource.options [i] .value)) {
addtolist (objobject, objSource.options [i] .text, objSource.options [i] .value);
}
}
}
}
función addallList ()
{
var objSource = form1.sourcelist;
var objobject = form1.objectList;
var Sourcelen = objsource.length;
para (var i = 0; i <sourcelen; i ++) {
if (! checkexist (objobject, objsource.options [i] .value)) {
addtolist (objobject, objSource.options [i] .text, objSource.options [i] .value);
}
}
}
Función eliminación de la lista (NoremoveValue)
{
var objobject = form1.objectList;
para (var i = 0; i <objobject.length; i ++) {
if (objobject.options [i] .selected && objobject.options [i] .Value! = NoremoveValue)
{
objobject.options.remove (i);
removelista (NoremoveValue); ruptura;
}
}
}
función removealllist (NoremoveValue)
{
var objobject = form1.objectList;
var objlen = objobject.length;
para (var i = 0; i <objlen; i ++) {
if (objobject.options [i] .Value! = NoremoveValue) {
objobject.options.remove (i);
Removealllist (NoremoveValue); romper;
}
}
}
función seleccionada todo (obj)
{
para (var i = 0; i <obj.length; i ++) {
obj.options [i] .selected = true;
}
}
función checkexist (obj, valor)
{
var isExist = false;
para (var i = 0; i <obj.length; i ++) {
if (obj.options [i] .value == valor) {
isExist = true;
romper;
}
}
devolver isexist;
}
función addTolist (obj, valor, etiqueta) {
obj.add (nueva opción (valor, etiqueta));
}
</script>
</ablo>
<Body bgcolor = "#ffffff">
<form de nombre = "form1" action = "temp.asp" método = "post">
<TABLE CELLSPACING = "0" CellPadding = "0">
<tr>
<TD> <select name = "Sourcelist" size = "10" múltiples id = "Sourcelist">
<opción valor = "a"> 1 </opción>
<opción valor = "b"> 2 </opción>
<opción valor = "c"> 3 </opción>
<%
para i = 6 a 20
Response.Write ("<option value =" "" & i+200 & "" ">" & i+200 & "</option>" & vbcrlf)
Próximo
%>
</elect> </td>
<TD> <input name = "add" type = "button" id = "add" value = "add" onClick = "addSelectedList ()"> <br>
<input name = "add" type = "button" id = "add" value = "add thel" onClick = "addallList ()"> <br>
<input name = "add" type = "button" id = "add" valor = "remove" onClick = "removeSelectedList ('a')"> <br>
<input name = "add" type = "button" id = "add" value = "eliminar todo" onClick = "removealllist ('a')">
<input name = "add" type = "button" id = "add" value = "select thel" onClick = "selectionAll (form1.objectList)"> </td>
<TD> <select name = "ObjectList" size = "10" múltiple id = "ObjectList">
<opción valor = "a"> 1 </opción>
<opción valor = "d"> 4 </opción>
<opción valor = "e"> 5 </opción>
<%
para i = 6 a 20
Response.Write ("<option value =" "" & i & "" ">" & i & "</option>" & vbcrlf)
Próximo
%>
</elect> </td>
</tr>
<tr>
<TD> </td>
<TD> <input name = "Sub" type = "Subt" value = "Subt"> </td>
<TD> </td>
</tr>
</table>
</form>
</body>
</html>