复制代码代码如下:
<%
dim a
a = split (request.form ("Sourcelist"), ",")
Response.Write "Source:" & request.form ("SourceList") & Ubound (a) & "<br> Objet:" & request.form ("ObjectList") & "<br>"
%>
<html>
<adal>
<meta http-equiv = "content-type" content = "text / html; charset = gb2312">
<Title> Document sans titre </TITME>
<Style type = text / css>
.bgSubleft {
Position d'arrière-plan: fond central; Image d'arrière-plan: URL (images / bgleft.gif); République de fond: répéter-x
}
.bgSubleftn {
Position d'arrière-plan: bas gauche; Image d'arrière-plan: URL (images / bgleftn.gif); Républiaison des antécédents: sans répétition
}
</ Style>
<script lingots = "javascript" type = "text / javascript">
fonction addSelectedList ()
{
var objsource = form1.sourcelist;
var objObject = Form1.ObjectList;
var sourcelen = objsource.length;
pour (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);
}
}
}
}
fonction addallList ()
{
var objsource = form1.sourcelist;
var objObject = Form1.ObjectList;
var sourcelen = objsource.length;
pour (var i = 0; i <Sourcelen; i ++) {
if (! checkexist (objObject, objsource.options [i] .value)) {
addtolist (objObject, objsource.options [i] .text, objsource.options [i] .value);
}
}
}
Fonction supprime la liste (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);
Removelist (NoreMoveValue); Break;
}
}
}
Fonction RemovealLlist (NoreMoveValue)
{
var objObject = Form1.ObjectList;
var objlen = objObject.length;
pour (var i = 0; i <objlen; i ++) {
if (objObject.options [i] .value! = NOREMOVEVALUE) {
objObject.options.remove (i);
Removealllist (NoreMoveValue); Break;
}
}
}
fonction sélectionnée (OBJ)
{
pour (var i = 0; i <obj.length; i ++) {
obj.options [i] .selected = true;
}
}
Fonction CheckExist (OBJ, valeur)
{
var isExist = false;
pour (var i = 0; i <obj.length; i ++) {
if (obj.options [i] .value == valeur) {
isExist = true;
casser;
}
}
retour isExist;
}
fonction addtolist (obj, valeur, label) {
obj.add (nouvelle option (valeur, étiquette));
}
</cript>
</ head>
<corps bgcolor = "# ffffff">
<form name = "form1" action = "temp.asp" méthode = "post">
<table cellSpacing = "0" cellpadding = "0">
<tr>
<td> <select name = "SourceList" size = "10" multiple id = "SourceList">
<Option Value = "A"> 1 </ Option>
<Option Value = "B"> 2 </ Option>
<Option Value = "C"> 3 </ Option>
<%
pour i = 6 à 20
Réponse.write ("<option valeur =" "" & i + 200 & "" ">" & i + 200 & "</opoption>" & vbcrlf)
Suivant
%>
</lect> </td>
<td> <entrée name = "add" type = "bouton" id = "add" value = "add" onclick = "addSelectedList ()"> <br>
<input name = "add" type = "bouton" id = "add" value = "add all" onclick = "addalllist ()"> <br>
<input name = "add" type = "bouton" id = "add" value = "retire" onclick = "retireselectedList ('a')"> <br>
<input name = "add" type = "bouton" id = "add" value = "supprimer tout" onclick = "removealLlist ('a')">
<input name = "add" type = "bouton" id = "add" value = "sélectionnez tout" onclick = "selectedall (form1.objectList)"> </td>
<td> <select name = "objectList" size = "10" multiple id = "objectList">
<Option Value = "A"> 1 </ Option>
<Option Value = "D"> 4 </ Option>
<Option Value = "E"> 5 </ Option>
<%
pour i = 6 à 20
Réponse.write ("<option value =" "" & i & "" ">" & i & "</ option>" & vbcrlf)
Suivant
%>
</lect> </td>
</tr>
<tr>
<td> </td>
<td> <input name = "sub" type = "soumi" value = "soumi"> </td>
<td> </td>
</tr>
</ table>
</ form>
</docy>
</html>