Como se muestra a continuación:
Copiar código del código de la siguiente manera:
<!
<html xmlns = "http://www.w3.org/1999/xhtml">
<Evista>
<meta http-oquiv = "content-type" content = "text /html; charset = utf-8" /> />
<title> Documento no -tito </title>
<script type = "text/javaScript">
Function copyTolist (de, a) {
var fromList = eval ('document.forms [0].'+desde);
var tolist = eval ('document.forms [0].'+a);
if (tolist.options.length> 0 && tolist.options [0]. valor == 'temp') {
Tolist.options.length = 0;
}
var sel = false;
para (i = 0; i <teomlist.options.length; i ++) {
var current = fromList.options [i];
if (current.select) {
Sel = verdadero;
If (current.value == 'temp') {{
Alerta ('¡No puedo elegir este proyecto!');
Devolver;
}
txt = current.Text;
valor = corriente.value;
tolist.options [tolist.length] = nueva opción (txt, valor);
FromList.options [i] = null;
i ---;
}
}
if (! sel) alerta ('¡No has elegido ningún proyecto todavía!');
}
función allSelect () {
var chsen = document.getElementById ('elegido');
// Si el cuadro de lista de CHSEN es 0 o el primer valor de opción es 'Temp'
if (chsen.length && chsen.opting [0]. valor == "temp")
Devolver;
para (var i = 0; i <chsen.length; i ++) {
chsen.options [i] .select = true;
}
// Obtener datos
Función getData () {
var list = document.forms [0] .rolelist;
// Obtener un objeto de cuadro de texto oculto
roles var = document.getElementById ("trolelist");
roles.value = "";
var s = "";
if (list.length! = 0) {{
para (i = 0; i <list.length; i ++) {
s + = list.option [i].
}
}
Roles.value = s;
}
}
</script>
</ablo>
<Body>
<Table>
<Form OnSubMit = "AllSelect ()">
<tr>
<TD>
<select name = "postible" size = "4" múltiple>
<opción valor = "1"> Guangzhou, China </opción>
<opción valor = "2"> Shanghai, China </ppection>
<opción valor = "3"> Beijing, China </ppection>
<opción valor = "4"> China Wuhan </ppection>
</select>
</td>
<td> <a href = "javascript: copytolist ('posible', 'elegido')"> Agregar a la derecha-> <br>
<br>
</a> <a href = "javaScript: copyTolist ('elegido', 'postible')"> <-add a la izquierda </a> </td>
<TD>
<select name = "elegido" size = "4" múltiple>
<opción valor = "prueba"> Seleccione su área desde la izquierda </ppection>
</select>
</td>
</tr>
</form>
</table>
<input type = "button" value = "Subt" onClick = "allSelect ()" /> yle
<input type = "text" style = "display: none;"
</body>
</html>