Foros del Web » Programando para Internet » Javascript »

Pasar items de una lado a otro

Estas en el tema de Pasar items de una lado a otro en el foro de Javascript en Foros del Web. Master's Alguien podria ayudarme con esto por favor: Quiero saber como puedo mover items de un lado a otro y viceversa, espero que me entiendan ...
  #1 (permalink)  
Antiguo 15/05/2003, 19:42
 
Fecha de Ingreso: enero-2002
Ubicación: Veracruz
Mensajes: 67
Antigüedad: 22 años, 4 meses
Puntos: 0
De acuerdo Pasar items de una lado a otro

Master's
Alguien podria ayudarme con esto por favor:

Quiero saber como puedo mover items de un lado a otro y viceversa, espero que me entiendan es algo asi como esto:

ivan         &n bsp;       adolfo
carlos        &nbsp ;     mauricio
memo << - >>
erick
albino


Gracias por su ayuda
__________________
:cool:
  #2 (permalink)  
Antiguo 15/05/2003, 23:32
Avatar de TurKa  
Fecha de Ingreso: enero-2003
Ubicación: Gerli, Avellaneda
Mensajes: 543
Antigüedad: 21 años, 3 meses
Puntos: 4
Esto se hace con javascript.
Aquí tienes el código:

<!-- PRIMER PASO: Copiar dentro del tag HEAD -->

<script LANGUAGE="JavaScript">

<!--
sortitems = 1;

function move(fbox,tbox) {
for(var i=0; i<fbox.options.length; i++) {
if(fbox.options[i].selected && fbox.options[i].value != "") {
var no = new Option();
no.value = fbox.options[i].value;
no.text = fbox.options[i].text;
tbox.options[tbox.options.length] = no;
fbox.options[i].value = "";
fbox.options[i].text = "";
}
}
BumpUp(fbox);
if (sortitems) SortD(tbox);
}
function BumpUp(box) {
for(var i=0; i<box.options.length; i++) {
if(box.options[i].value == "") {
for(var j=i; j<box.options.length-1; j++) {
box.options[j].value = box.options[j+1].value;
box.options[j].text = box.options[j+1].text;
}
var ln = i;
break;
}
}
if(ln < box.options.length) {
box.options.length -= 1;
BumpUp(box);
}
}

function SortD(box) {
var temp_opts = new Array();
var temp = new Object();
for(var i=0; i<box.options.length; i++) {
temp_opts[i] = box.options[i];
}
for(var x=0; x<temp_opts.length-1; x++) {
for(var y=(x+1); y<temp_opts.length; y++) {
if(temp_opts[x].text > temp_opts[y].text) {
temp = temp_opts[x].text;
temp_opts[x].text = temp_opts[y].text;
temp_opts[y].text = temp;
temp = temp_opts[x].value;
temp_opts[x].value = temp_opts[y].value;
temp_opts[y].value = temp;
}
}
}
for(var i=0; i<box.options.length; i++) {
box.options[i].value = temp_opts[i].value;
box.options[i].text = temp_opts[i].text;
}
}
// -->
</script>

<!-- SEGUNDO PASO: Copiar dentro del tag BODY -->

<form ACTION METHOD="POST">
<table border="0">
<tr>
<td><select multiple size="5" name="list1">
<option value="11"> item 1.1 </option>
<option value="12"> item 1.2 </option>
<option value="13"> item 1.3 </option>
</select></td>
<td><input type="button" value=" &gt;&gt; "
onclick="move(this.form.list1,this.form.list2)" name="B1"><br>
<input type="button" value=" &lt;&lt; "
onclick="move(this.form.list2,this.form.list1)" name="B2"> </td>
<td><select multiple size="5" name="list2">
<option value="21"> item 2.1 </option>
<option value="22"> item 2.2 </option>
<option value="23"> item 2.3 </option>
</select></td>
</tr>
</table>
</form>
__________________
Programación LAMP con Scrum y XP
www.eugeniabahit.com.com.ar
  #3 (permalink)  
Antiguo 16/05/2003, 02:42
Avatar de tunait
Moderadora
 
Fecha de Ingreso: agosto-2001
Ubicación: Terok Nor
Mensajes: 16.805
Antigüedad: 22 años, 8 meses
Puntos: 381
Mensaje Movido a Javascript

  #4 (permalink)  
Antiguo 16/05/2003, 08:09
 
Fecha de Ingreso: enero-2002
Ubicación: Veracruz
Mensajes: 67
Antigüedad: 22 años, 4 meses
Puntos: 0
Ok,
Muchas gracias
__________________
:cool:
  #5 (permalink)  
Antiguo 16/05/2003, 15:01
Avatar de Kaopectate
Colaborador
 
Fecha de Ingreso: diciembre-2001
Ubicación: Curaçao (Antillas Holandesas)
Mensajes: 3.179
Antigüedad: 22 años, 4 meses
Puntos: 38
Hola Ivan.

Creo que el FAQ-64 te viene como anillo al dedo. Cuentame por favor si se ajusta o no.

(Podríamos recortar un poco tus dedos de ser necesario)

Saludos.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 11:16.