Os dejo todo el codigo aki...
Cita:
<html>
<head>
<title>Selecciona elementos en lista 2</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Kathi O'Shea (Kathi.O'[email protected]) -->
<!-- Web Site: http://www.web-savant.com/users/kathi/asp -->
<!-- Begin
function moveOver()
{
var boxLength = document.choiceForm.choiceBox.length;
var selectedItem = document.choiceForm.available.selectedIndex;
var selectedText = document.choiceForm.available.options[selectedItem].text;
var selectedValue = document.choiceForm.available.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.choiceForm.choiceBox.options[i].text;
if (thisitem == selectedText) {
isNew = false;
break;
}
}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.choiceForm.choiceBox.options[boxLength] = newoption;
}
document.choiceForm.available.selectedIndex=-1;
}
function removeMe() {
var boxLength = document.choiceForm.choiceBox.length;
arrSelected = new Array();
var count = 0;
for (i = 0; i < boxLength; i++) {
if (document.choiceForm.choiceBox.options[i].selected) {
arrSelected[count] = document.choiceForm.choiceBox.options[i].value;
}
count++;
}
var x;
for (i = 0; i < boxLength; i++) {
for (x = 0; x < arrSelected.length; x++) {
if (document.choiceForm.choiceBox.options[i].value == arrSelected[x]) {
document.choiceForm.choiceBox.options[i] = null;
}
}
boxLength = document.choiceForm.choiceBox.length;
}
}
function saveMe() {
var strValues = "";
var boxLength = document.choiceForm.choiceBox.length;
var count = 0;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
if (count == 0) {
strValues = document.choiceForm.choiceBox.options[i].value;
}
else {
strValues = strValues + "," + document.choiceForm.choiceBox.options[i].value;
var url='<? echo "1" ?>';
}
count++;
}
}
if (strValues.length == 0) {
alert("No has hecho ninguna selección");
}
else {
alert("Aquí están los valores seleccionados:\r\n" + strValues);
}
}
// End -->
</script>
</head>
<html>
<BODY>
<p align="center"><b>Selecciona elementos en lista 2</b></p>
<center>
<form name="choiceForm" method="get" action="2.php">
<table border=0 width="414">
<tr>
<td valign="top" width=227>
<font size="2">Contenido disponible: </font>
<br>
<select name="available" size=10 onchange="moveOver();">
<option value=1>Noticias de la compañía
<option value=2>Noticias de industria
</select>
</td>
<td valign="top" width="177">
<font size="2">Tu selección: </font>
<br>
<select multiple name="choiceBox" style="width:150;" size="10">
</select>
</td>
</tr>
<tr>
<td colspan=2 height=10 width="390">
<input type="button" value="Eliminar seleccionados" onclick="removeMe();" style="font-size: 8pt">
<input type="button" value="Obtener valores seleccionados" onclick="saveMe();" style="font-size: 8pt">
</td>
</tr>
</table>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
</form>
</center>
</body>
</html>
<head>
<title>Selecciona elementos en lista 2</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Kathi O'Shea (Kathi.O'[email protected]) -->
<!-- Web Site: http://www.web-savant.com/users/kathi/asp -->
<!-- Begin
function moveOver()
{
var boxLength = document.choiceForm.choiceBox.length;
var selectedItem = document.choiceForm.available.selectedIndex;
var selectedText = document.choiceForm.available.options[selectedItem].text;
var selectedValue = document.choiceForm.available.options[selectedItem].value;
var i;
var isNew = true;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
thisitem = document.choiceForm.choiceBox.options[i].text;
if (thisitem == selectedText) {
isNew = false;
break;
}
}
}
if (isNew) {
newoption = new Option(selectedText, selectedValue, false, false);
document.choiceForm.choiceBox.options[boxLength] = newoption;
}
document.choiceForm.available.selectedIndex=-1;
}
function removeMe() {
var boxLength = document.choiceForm.choiceBox.length;
arrSelected = new Array();
var count = 0;
for (i = 0; i < boxLength; i++) {
if (document.choiceForm.choiceBox.options[i].selected) {
arrSelected[count] = document.choiceForm.choiceBox.options[i].value;
}
count++;
}
var x;
for (i = 0; i < boxLength; i++) {
for (x = 0; x < arrSelected.length; x++) {
if (document.choiceForm.choiceBox.options[i].value == arrSelected[x]) {
document.choiceForm.choiceBox.options[i] = null;
}
}
boxLength = document.choiceForm.choiceBox.length;
}
}
function saveMe() {
var strValues = "";
var boxLength = document.choiceForm.choiceBox.length;
var count = 0;
if (boxLength != 0) {
for (i = 0; i < boxLength; i++) {
if (count == 0) {
strValues = document.choiceForm.choiceBox.options[i].value;
}
else {
strValues = strValues + "," + document.choiceForm.choiceBox.options[i].value;
var url='<? echo "1" ?>';
}
count++;
}
}
if (strValues.length == 0) {
alert("No has hecho ninguna selección");
}
else {
alert("Aquí están los valores seleccionados:\r\n" + strValues);
}
}
// End -->
</script>
</head>
<html>
<BODY>
<p align="center"><b>Selecciona elementos en lista 2</b></p>
<center>
<form name="choiceForm" method="get" action="2.php">
<table border=0 width="414">
<tr>
<td valign="top" width=227>
<font size="2">Contenido disponible: </font>
<br>
<select name="available" size=10 onchange="moveOver();">
<option value=1>Noticias de la compañía
<option value=2>Noticias de industria
</select>
</td>
<td valign="top" width="177">
<font size="2">Tu selección: </font>
<br>
<select multiple name="choiceBox" style="width:150;" size="10">
</select>
</td>
</tr>
<tr>
<td colspan=2 height=10 width="390">
<input type="button" value="Eliminar seleccionados" onclick="removeMe();" style="font-size: 8pt">
<input type="button" value="Obtener valores seleccionados" onclick="saveMe();" style="font-size: 8pt">
</td>
</tr>
</table>
<p>
<input type="submit" name="Submit" value="Enviar">
</p>
</form>
</center>
</body>
</html>
Asias por todo!!!