Ciao,
ho questo script per passare dei valori da una lista all'altra. Funziona bene a livello di script, il problema č che non invia il form. Perchč?
codice:
<html>
<head>
<title>Selecciona elementos en lista</title>
<p align="center">Selecciona elementos en lista
<!--
This file retrieved from the JS-Examples archives
http://www.js-examples.com
100s of free ready to use scripts, tutorials, forums.
Author: Jan Seda - 0
-->
<style>
.inputF {
width=170;
height=150;
background-color:#FAFB99
}
.inputF2 {
width=170;
background-color:#FAFB99
}
.listCell{
background-color:#FCFE52;
layer-background-color: #FCFE52;
}
.selCell {
background-color:#7073FE;
border-style:inset;
border-width:1px;
border-left-color:white;
border-top-color:white;
border-bottom-color:black;
border-right-color:black;
}
H6 {
COLOR: white; FONT-FAMILY: Arial, helvetica CE, helvetica; FONT-SIZE: 8pt; FONT-STYLE: normal; FONT-WEIGHT: normal
}
TABLE {
COLOR: black;
FONT-FAMILY: Arial, helvetica CE, helvetica;
FONT-SIZE: 9pt;
FONT-STYLE: normal;
FONT-WEIGHT: normal;
display: block;
}
SELECT {
COLOR: black; FONT-FAMILY: Arial, helvetica CE, helvetica; FONT-SIZE: 9pt; FONT-STYLE: normal; FONT-WEIGHT: normal;
}
</style>
<script LANGUAGE="JavaScript">
<!--
function moveVals(n, from, to) {
if (document.layers) {
fromObj = document.layers[from];
to = document.layers[to];
} else if (document.all) {
fromObj = document.all(from);
to = document.all(to);
}
if (n == 1 || n == 2) {
var indTo = to.length-1;
for (i=fromObj.length-1; i>=0; i--) {
if (n==1 || fromObj.options[i].selected) {
indTo++;
to.options[indTo] = new Option(fromObj.options[i].text, fromObj.options[i].value);
fromObj.options[i] = null;
}
}
} else if (n == 3 || n == 4) {
var indFrom = fromObj.length-1;
for (i=to.length-1; i>=0; i--) {
if (n==4 || to.options[i].selected) {
indFrom++;
fromObj.options[indFrom] = new Option(to.options[i].text, to.options[i].value);
to.options[i] = null;
}
}
}
}
function frmButtons() {
var select = "chosen";
var avail = "avail";
if (document.layers) {
var sel = document.layers[select];
var av = document.layers[avail];
} else if (document.all) {
var sel = document.all(select);
var av = document.all(avail);
}
if (sel.length <= 0) {
document.frmAddPro.btnR.disabled = true;
document.frmAddPro.btnRR.disabled = true;
} else {
document.frmAddPro.btnR.disabled = false;
document.frmAddPro.btnRR.disabled = false;
}
if (av.length <= 0) {
document.frmAddPro.btnL.disabled = true;
document.frmAddPro.btnLL.disabled = true;
} else {
document.frmAddPro.btnL.disabled = false;
document.frmAddPro.btnLL.disabled = false;
}
}
function deleteFrom() {
for (i=0; i<document.frmAddPro.elements.length-1; i++) {
if (document.frmAddPro.elements[i].tagName.indexOf("SELECT") && document.frmAddPro.elements[i].id.indexOf("av")) {
alert("Cislo: "+i+" Name: "+document.frmAddPro.elements[i].tagName);
}
}
}
-->
</script>
</head>
<body>
</p>
<center>
<form NAME="frmAddPro">
<table height="172">
<tr>
<td WIDTH="170" CLASS="selCell" style="background-color: #FFFFFF" height="14">
Ciudades disponibles:</td>
<td bgcolor="#FFFFFF" height="14"></td>
<td WIDTH="170" CLASS="selCell" style="background-color: #FFFFFF" height="14">
Tu favorita:</td>
</tr>
<tr>
<td height="150"><select MULTIPLE CLASS="inputF" NAME="avail" ID="av">
<option>Berlín</option>
<option>Londres</option>
<option>Luxemburgo</option>
<option>Nueva York</option>
<option>Paris</option>
<option>Praga</option>
<option>Tokyo</option>
</select> </td>
<td ALIGN="CENTER" VALIGN="CENTER" height="150">
<input TYPE="button" VALUE=">>" STYLE="{width=25;}" NAME="btnLL" onClick="javascript: moveVals(1, 'avail', 'chosen'); frmButtons(); return false;">
<input TYPE="button" VALUE=">" STYLE="{width=25;}" NAME="btnL" onClick="javascript: moveVals(2, 'avail', 'chosen'); frmButtons(); return false;">
<input TYPE="button" VALUE="<" STYLE="{width=25;}" NAME="btnR" onClick="javascript: moveVals(3, 'avail', 'chosen'); frmButtons(); return false;">
<input TYPE="button" VALUE="<<" STYLE="{width=25;}" NAME="btnRR" onClick="javascript: moveVals(4, 'avail', 'chosen'); frmButtons(); return false;">
</td>
<td height="150"><select MULTIPLE CLASS="inputF" NAME="chosen"></select>
</td>
</tr>
</table>
</form>
</center>
Special permission was granted to JS-X to present this script here
<script>
frmButtons();
</script>
</h6>
<h6></h6>
</body>
</html>