salve,
ho un form creato dinamicamente...
Codice PHP:
<input type="text" name="qty[]" id="qty[]" value=<? echo $qty[$i]; ?> >
<input type="hidden" name="qty_disp[]" id="qty_disp[]" value=<? echo $disp[$i]; ?> >
<input type="text" name="qty[]" id="qty[]" value=<? echo $qty[$i]; ?> >
<input type="hidden" name="qty_disp[]" id="qty_disp[]" value=<? echo $disp[$i]; ?> >
<input type="text" name="qty[]" id="qty[]" value=<? echo $qty[$i]; ?> >
<input type="hidden" name="qty_disp[]" id="qty_disp[]" value=<? echo $disp[$i]; ?> >
<input type="text" name="qty[]" id="qty[]" value=<? echo $qty[$i]; ?> >
<input type="hidden" name="qty_disp[]" id="qty_disp[]" value=<? echo $disp[$i]; ?> >
di queste coppie possono essere n....
voglio una funzione javascript che se inserisco nel campo qty[] un valore maggiore di qty_disp[]
mi dia un alert...
ho qst funzione ma non so come adattarla ai vettori
Codice PHP:
function goFocus(x) {
document.getElementById(x).focus();
document.getElementById(x).select();
}
function confronto(x) {
var qty = parseInt(document.getElementById(x).value);
var qty_disp = parseInt(document.getElementById(x+"_disp").value); if(qty>qty_disp){
var mess="Quantità Disponibile: ";
var alarm=mess + qty_disp;
alert(alarm);
setTimeout(function(){goFocus(x);},50);
} }
ah... i vettori sono ordinati
in pratica il controllo dev'essere qty[0]<qty_disp[0] e cosi via
grazie