boa tarde tenho a funcao de JS
function ValidarDados(){
var teste = true;
var saida = "O(s) Seguinte(s) Campo(s) é (são) obrigatório(s):";
if (document.getElementById ('nome').value == ''){
saida += "\nNome";
teste = false;
}
if (document.getElementById ('cpf').value == ''){
saida += "\nCPF Invalido ";
teste = false;
// AKI EU SO POSSO ACEITAR NUMEROS ,COMO POSSO FASER ISSO?
// SE POSSIVEL COMO POSSO ESTAR VALIDANDO O MSMO ???
}
if (document.getElementById ('telefone').value == ''){
saida += "\nTelefone";
teste = false;
}
if (document.getElementById ('rg').value == ''){
saida += "\nRG";
teste = false;
}
if (document.getElementById ('estado_civil').value == ''){
saida += "\nEstado Civil";
teste = false;
}
if (document.getElementById ('ativo').value == '' || document.getElementById ('ativo').value !='1'&& document.getElementById ('ativo').value != '2'){
saida += "\nAtivo (1- ATIVO e 2-INATIVO)";
teste = false;
}
if (document.getElementById ('dt_cadastro').value == ''){
saida += "\nData do cadastro ";
teste = false;
}
if (document.getElementById ('endereco').value == ''){
saida += "\nendereco";
teste = false;
}
if (teste){
return true;
}else{
alert (saida);
return false;
}
}
</script>
aqui eu chamo a funcao
<tr>
<td colspan=2><input type=submit name=cadastra id=cadastra value=Cadastrar onclick="return ValidarDados();" /></td>
</tr>
grato pela ajuda !!