Ir para conteúdo
Fórum Script Brasil
  • 0

Erro No Estranho


mestre fyoda

Pergunta

linha 100

caractere 1

erro : document.formulario.nome.value é nulo ou não é um objeto .

<html>
<head><title>Cadastro</title>

<script language="javascript">

function valida() {
var nome=document.formulario.nome.value;
var sobre_nome=document.formulario.sobre_nome.value;
var email=document.formulario.email.value;
var estado=document.formulario.estado.value;
var login=document.formulario.login.value;
var senha=document.formulario.senha.value;
var confirma_senha=document.formulario.confirma_senha.value;

if (nome=="") { 
window.alert(" » Preencha o campo Nome « ");
document.formulario.nome.focus();
return false;
}
if (sobre_nome=="") {
window.alert(" » Preencha o campo Sobre Nome « ");
document.formulario.sobre_nome.focus();
return false;
}

 array_mes=["02","04","06","09","11"];
 erro= "Data Inválida"
 dia=document.formulario.data_nas.value.charAt(0)+document.formulario.data_nas.value.charAt(1);
 mes=document.formulario.data_nas.value.charAt(3)+document.formulario.data_nas.value.charAt(4);
 year=document.formulario.data_nas.value.charAt(6)+document.formulario.data_nas.value.charAt(7)+document.formulario.data_nas.value.charAt(8)+document.formulario.data_nas.value.charAt(9);

 if(document.formulario.data_nas.value.length<10){
     alert(erro);
     document.formulario.data_nas.value="";
     document.formulario.data_nas.focus();
     return false;
   }

 texto=document.formulario.data_nas.value;
 if(parseInt(texto.substr(6,10)) % 4==0)
   ano="bissexto";
 else
   ano="";

 if (dia<1 || dia>31 || mes<1 || mes>12){
   alert(erro);
   document.formulario.data_nas.value="";
   document.formulario.data_nas.focus();
   return false;
 }

 for(x=0; x<array_mes.length; x++){
   if(mes == array_mes[x] && dia>30){
     alert(erro)
     document.formulario.data_nas.value="";
     document.formulario.data_nas.focus();
     return false;
   }
 }

 if (ano!="bissexto" && dia>28 && mes==2){
     alert(erro)
     document.formulario.data_nas.value="";
     document.formulario.data_nas.focus();
     return false;
 }
 if (ano=="bissexto" && dia>29 && mes==2){
     alert(erro)
     document.formulario.data_nas.value="";
     document.formulario.data_nas.focus();
     return false;
 }

 if (year<1900){
     alert(year)
     document.formulario.data_nas.value="";
     document.formulario.data_nas.focus();
     return false;
 }

if (estado == "#" ) {
window.alert(" » Escolha o seu Estado « ");
document.formulario.estado.focus();
return false;
}
if (login=="") {
window.alert(" » Preencha o campo Login « ");
document.formulario.login.focus();
return false;
}
if (senha=="") {
window.alert(" » Preencha o campo Senha « ");
document.formulario.senha.focus();
return false;
}
if (confirma_senha=="") {
window.alert(" » Preencha o campo Confirma Senha « ");
document.formulario.confirma_senha.focus();
return false;
}
if (senha!=confirma_senha) {
window.alert(" » Senha diferenta do Confirma Senha « ");
document.formulario.confirma_senha.focus();
return false;
}
if (email=="") {
window.alert(" » Preencha o campo E-Mail « ");
document.formulario.email.focus();
return false;
}
if (email.indexOf("@") == -1 || email.indexOf(".") == -1) {
window.alert(" » E-Mail inválido « ");
document.formulario.email.focus();
return false;
}

return true;
document.formulario.submit();
}

</script>






<script language="JavaScript">

function txtBoxFormat(objForm, strField, sMask, evtKeyPress) {
     var i, nCount, sValue, fldLen, mskLen,bolMask, sCod, nTecla;

     if(document.all) { // Internet Explorer
       nTecla = evtKeyPress.keyCode; }
     else if(document.layers) { // Nestcape
       nTecla = evtKeyPress.which;
     }

     sValue = objForm[strField].value;

     // Limpa todos os caracteres de formatação que
     // já estiverem no campo.
     sValue = sValue.toString().replace( "-", "" );
     sValue = sValue.toString().replace( "-", "" );
     sValue = sValue.toString().replace( ".", "" );
     sValue = sValue.toString().replace( ".", "" );
     sValue = sValue.toString().replace( "/", "" );
     sValue = sValue.toString().replace( "/", "" );
     sValue = sValue.toString().replace( "(", "" );
     sValue = sValue.toString().replace( "(", "" );
     sValue = sValue.toString().replace( ")", "" );
     sValue = sValue.toString().replace( ")", "" );
     sValue = sValue.toString().replace( " ", "" );
     sValue = sValue.toString().replace( " ", "" );
     fldLen = sValue.length;
     mskLen = sMask.length;

     i = 0;
     nCount = 0;
     sCod = "";
     mskLen = fldLen;

     while (i <= mskLen) {
       bolMask = ((sMask.charAt(i) == "-") || (sMask.charAt(i) == ".") || (sMask.charAt(i) == "/"))
       bolMask = bolMask || ((sMask.charAt(i) == "(") || (sMask.charAt(i) == ")") || (sMask.charAt(i) == " "))

       if (bolMask) {
         sCod += sMask.charAt(i);
         mskLen++; }
       else {
         sCod += sValue.charAt(nCount);
         nCount++;
       }

       i++;
     }

     objForm[strField].value = sCod;

     if (nTecla != 8) { // backspace
       if (sMask.charAt(i-1) == "9") { // apenas números...
         return ((nTecla > 47) && (nTecla < 58)); } // números de 0 a 9
       else { // qualquer caracter...
         return true;
       } }
     else {
       return true;
     }
      }


</script>



</head>
<body>



<font color="FF0000"><b><center>


</center></b></font>

<center>
<table >
<br><br>   
<form name="formulario" method="post" action="verifica.php" class="campoerro" onsubmit="window.open('','pop','scrollbars=no,width=300,height=200')" target=pop>


<tr>
	<align="center">  <td class="tabela2">Dados pessoais</td>  
</tr>


<tr>
<td>Nome:</td> 
<td><input type="text" name="nome" class="caixa" maxlength="10"></td> 
</tr>

<tr>
<td>Sobre Nome:</td>
<td><input type="text" name="sobre_nome" class="caixa"  maxlength="20"></td> 
</tr>

<tr>
<td>Data Nascimento:</td>
<td><input type="text" maxlength="10" class="caixa"  name="data_nas" onkeypress="return txtBoxFormat(document.formulario, 'data_nas', '99/99/9999', event);"></td>
</tr>

<div align="center">

<tr>
<td>Estado:</td> 
<td><select name="estado" style="font-family: Verdana; font-size: 8 pt; border-style: solid; border-color: #D5A06C" class="caixa"> 
<option value="#"></option>
<option value="AC">AC</option>
    <option value="AL">AL</option>
  <option value="AM">AM</option>
        <option value="AP">AP</option>
  <option value="BA">BA</option>
  <option value="CE">CE</option>
  <option value="DF">DF</option>
        <option value="ES">ES</option>
      <option value="GO">GO</option>
        <option value="MA">MA</option>
  <option value="MG">MG</option>
  <option value="MS">MS</option>
  <option value="MT">MT</option>
        <option value="PA">PA</option>
  <option value="PB">PB</option>
  <option value="PE">PE</option>
      <option value="PI">PI</option>
  <option value="PR">PR</option>
  <option value="RJ">RJ</option>
      <option value="RN">RN</option>
  <option value="RO">RO</option>
  <option value="RR">RR</option>
    <option value="RS">RS</option>
    <option value="SC">SC</option>
    <option value="SE">SE</option>
  <option value="SP">SP</option>
  <option value="TO">TO</option>
  </select>
          </div>
</td>
</tr>

<tr>
<align="center">   <td font class="tabela2">Dados da conta</td>  
</tr>    

<tr>
<td>Login:</td> 
<td><input type="text" name="login" class="caixa"   maxlength="10"></td> 
</tr>


<tr>
<td>Senha:</td>
<td><input type="password" name="senha" class="caixa" maxlength="10"></td> 
</tr>

<tr>
<td>Confirma Senha:</td>
<td><input type="password"  name="confirma_senha" class="caixa" maxlength="10"></td> 
</tr>


<tr>
<td> E-mail:</td>
<td><input type="text" name="email" class="caixa"  maxlength="30"></td> 
</tr>


<tr>
</tr>
</table>
</center>

<br><br>
<center>
<table >
<tr>
<td>  Knight&nbsp;&nbsp;  </td>  <td><input type="radio" name="prof" value="knight" checked></td>
</tr>

<tr>
<td>  Paladin&nbsp;&nbsp; </td>  <td><input type="radio" name="prof" value="paladin" ></td>
</tr>

<tr>
<td>  Druid&nbsp;&nbsp;   </td>  <td><input type="radio" name="prof" value="druid" ></td>
</tr>

<tr>
<td>  Sorcerer&nbsp;&nbsp;</td>  <td><input type="radio" name="prof" value="sorcerer" ></td>
</tr>
</table>   
<br>
   <input type="submit" value=" Cadastrar " class="botao" onclick="return valida()">
</center>
</form>
</body>
</html>

Link para o comentário
Compartilhar em outros sites

2 respostass a esta questão

Posts Recomendados

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,2k
    • Posts
      651,9k
×
×
  • Criar Novo...