Nel codice che segue vorrei mettetre il focus sull'oggetto "testo1" con l'struzione:
testo1.focus();
ma non viene messo e figura il messaggio:
Form elements must have labels.
Desidererei sapere che label dovrei mettere per far funzionare il focus. Grazie

lavoel

codice:
<!doctype html>
<html>
<body>
Studio di un numero: pari o dispari, positivo o negativo <br><br>
<input type="button" id ="bottone1" value="scrivi un numero --> " onclick="scrivi_studia()">
<input type="text" id="testo1" size=15><br><br>
analisi del  numero: <input type="text" id="testo2" size=40>
<script>
function scrivi_studia(){
testo1.focus();
n=parseInt(testo1.value)
if (n==0){testo2.value="il numero è zero"}
 else if (n%2==0 && n>0){testo2.value= n + " è pari e positivo"}
 else if (n%2==0 && n<0) {testo2.value= n + " è pari e negativo"}
 else if (n%2!==0 && n>0) {testo2.value= n + " è dispari e positivo"}
 else if (n%2!==0 && n<0) {testo2.value= n + " è dispari e negativo"}
else {testo2.value="n non è un numero"}
}
</script
</body>
</html