Validar formulário em Javascript
Fevereiro 7, 2008
- <script language=”javascript” type=”text/javascript”>
- function valida(formulario){
- var total = formulario.elements.length;
- i = 0
- while (i <= total)
- {
- if(formulario.elements[i].value == “”){
- // alert(”O campo ” + formulario.elements[i].name + “ continua vazio.”);
- formulario.elements[i].focus();
- return false;
- break;
- }
- i++
- }
- }
- </script>
- <form onSubmit=”return valida(this);”>
Entry Filed under: JavaScript, Programação Web. .
3 Comments Add your own
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>
Trackback this post | Subscribe to the comments via RSS Feed
1.
Vanessa | Dezembro 1, 2008 at 4:17 pm
testando, testando
2.
Rafaela Poiani | Dezembro 7, 2008 at 10:34 pm
Oiiiee
3.
andre luiz | Janeiro 20, 2009 at 7:45 am
ficou simples pratico e funciona!!!