ho fatto una semplice funzione in javascript che controlla se la qty in un campo input è minore di quella disponibile.... senno manda un alert...
come faccio dopo il click sull'alert avere il focus nel campo qty...
codice:
<html>
<head>
<title>Esempio</title>
<script type="text/javascript">
function confronto(x)
{
if(document.getElementById(x).value>document.getElementById(x+"_disp").value){
var mess="Quantità Disponibile: ";
var alarm=mess + document.getElementById(x+"_disp").value;
alert(alarm);
}
}
</script>
</head>
<body onload="document.pro.prod.focus();">
<form name="pro" method="post">
QTY<input type="text" name="qty32" id="qty32" value=1 onblur="confronto(this.id)">
<input type="hidden" name="qty32_disp" id="qty32_disp" value=10 >
id=32
qty disponibile=10
modello=mod_prod_1
immagine=prod_1.gif
QTY<input type="text" name="qty33" id="qty33" value=1 onblur="confronto(this.id)">
<input type="hidden" name="qty33_disp" id="qty33_disp" value=15 >
id=33
qty disponibile=15
modello=mod_prod_2
immagine=prod_2.gif
<input type="hidden" name="prodotto[]" value="32-33-">
<input type="text" name="prod" id="prod">
<input type="reset" value="cancella">
<input type="submit" value="conferma">
</form>
</body>
</html>
logicamente c'è il php dietro che carica dal database...
grazie