Ciao ragazzi, non capisco nulla di Javascript conosco bene il PHP.
io devo controllare che l'input inserito sia un numero e non un testo.
Mi spiegate il codice da mettere in Javascript. Posto il codice:
codice:<script language=javascript> function verifica() { if (time.text != " " && parseInt(time.value) != time.value) { alert("Valori non corretti"); time.focus(); } return; } </script> <?php $tempo = array("secondi","minuti","ore","giorni","settimane","mesi"); echo "<table width=100% border=1>"; echo "<form action=regole.php method=post>"; echo "<tr style={background-color:red}><th >Regola</th><th>Opzione di Blocco</th></th>"; for($i=0; $i < count($regole); $i++) { echo "<tr>"; echo "<td width=80%>$regole[$i]</td>"; echo "<td width=20%>CHI:<select name=opzioni[]><option>Sorgente</option><option>Destinazione</option></select></br></br>"; echo "COME: <select name=opzioni[]><option>In Entrata</option><option>In Uscita</option><option>Entrambi</option></select></br></br>"; echo "Tempo: <input id=time type=text size=3 name=opzioni[]><select name=opzioni[]>"; for($j=0; $j < count($tempo); $j++) echo "<option>$tempo[$j]</option>"; echo "</select>"; echo "</td>"; echo "</tr>"; } echo "<tr style={background-color:red} ><td colspan=2 align=center><input type=submit name=conferma value=Conferma onclick=verifica();><input type=reset name=reset value=Reset></td></tr>"; echo "</form>"; echo "</table>"; ?>

Rispondi quotando

Non ho capito come funziona.
Non mi funziona mi fa inserire anche le lettere. provata su IE6 XPPro SP2