Ho messo anche un ciclo while per controllare l'inserimento, ma non parte lo stesso.
Ciao e grazie.codice:<!-- Indovinare un numero --> <html> <head> </head> <body> <script language="javascript"> var num, nc, i=1; num=prompt("Inserire un numero: "); while(num<1 || num > 100) { num=prompt("Il numero e' minore di 1 o maggiore di 100, reinseriscilo: "); } nc=Math.floor((Math.random()*100)+1); while(num!=nc) { if (num<nc) document.write("</br>Il numero e' piu\' grande"); if (num>nc) document.write("</br> Il numero e' piu\' piccolo"); num=prompt("Inserire un numero: "); i++; } if (i==1) document.write(+i" tentativo: Mitico"); if (i>=2 && ntent<=4) document.write(+i " tentativi: Bravissimo"); if (i>=5 && ntent<=10) document.write(+i" tentativi: Insomma"); if (i>=10) document.write(+i" tentativi: No Comment"); document.write("<br> Il gioco e' finito."); </script> <body> </html>