FeoS Posted January 6, 2010 at 02:43 PM Report Share #304465 Posted January 6, 2010 at 02:43 PM Estou a fazer um programa que é para a tabuada para um exercício na aula, e estou a usar um formulário a receber o número que quer fazer a tabuada e depois um for a apresentá-la. Mas tipo, podem introduzir letras que aquilo aceita na mesma, só não faz a conta. Como posso fazer de maneira a só aceitar números? Link to comment Share on other sites More sharing options...
KiNgPiTo Posted January 6, 2010 at 03:34 PM Report Share #304484 Posted January 6, 2010 at 03:34 PM Se fores por javascript, inseres um onsubmit no form e só faz o submit se a funcao js retornar true... Se deixares ir por php, crias um if com um is_nan($variavell). se for true, nao é um numero e nao deixas fazer a tabuada, senao ok, e faz a tabuada... Link to comment Share on other sites More sharing options...
FeoS Posted January 6, 2010 at 03:57 PM Author Report Share #304491 Posted January 6, 2010 at 03:57 PM obrigado 😉 resolvido Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now