Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <HTML>
- <HEAD>
- <SCRIPT>
- // script jsc31 valida 1
- // Este script valida basicamente um form nos seguintes aspetos:
- //
- // O campo nome tem que estar preenchido
- // O campo Numero BI tem que estar preenchido com pelo menos 8 números
- // e não pode conter caracteres alfabéticos
- // O campo correio tem que estar preenchido e conter o caracter @
- function validar()
- {
- if (document.ficha.nome.value.length == 0)
- {
- alert("Faltou o nome");
- return false;
- }
- if ( isNaN(document.ficha.numbi.value) )
- {
- alert("O BI deve conter apenas algarisnmos");
- return false;
- }
- else if (document.ficha.numbi.value.length < 8)
- {
- alert("Insira todos os numeros do BI");
- return false;
- }
- if (document.ficha.correio.value.indexOf("@") == -1)
- {
- alert("Email invalido");
- return false;
- }
- return true;
- }// fecha func
- </SCRIPT>
- </HEAD>
- <BODY onLoad="document.ficha.nome.focus()">
- <form name="ficha" method="post" action="mailto:josecamaraabc@serv.com"
- onSubmit="return validar();">
- Nome: <input type="text" name="nome" size="20" maxlength="30">
- <BR>
- Numero BI: <input type="text" name="numbi" size="10" maxlength="10">
- <BR>
- Correio Eletronico: <input type="text" name="correio" size="20" maxlength="20">
- <BR>
- <input type="Reset" value="Limpar">
- <BR>
- <input type="Submit" value="Enviar">
- <BR>
- </BODY>
- </HTML>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement