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

O Que Tem De Errado


rfp

Pergunta

O que há de errado com esse meu código javascript, eu acho que está correto, mais ele não funciona??

La vai o código:

<script language="JavaScript">

function liberar() {

if (document.vendas.nome.value !="")

{

if (document.vendas.nome.value.length < 5)

{

alert("Por Favor preencha Seu nome Completo.");

document.vendas.nome.focus();

return false;

}

}

else

{

alert("Por Favor preencha seu nome.");

document.vendas.nome.focus();

return false;

}

</script>

Link para o comentário
Compartilhar em outros sites

5 respostass a esta questão

Posts Recomendados

  • 0

Desde já agradeço pela ajuda!

não sei se você FA1CON vai ter saco pra ler o código inteiro mas mesmo assim, tai:

<html>

<head>

<script language="JavaScript">

function liberar() {

if (document.vendas.nome.value !="")

{

if (document.vendas.nome.value.length < 5)

{

alert("Por Favor preencha Seu nome Completo.");

document.vendas.nome.focus();

return false;

}

}

else

{

alert("Por Favor preencha seu nome.");

document.vendas.nome.focus();

return false;

}

}

</script>

<title>Cadastro Vendas</title>

</head>

<body bgcolor="#4070B0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<table width="99%" border="0" cellspacing="0" cellpadding="0" height="377">

<tr>

<td height="413" width="68%" bgcolor="#407CC8" valign="top" align="center">

<table width="65%" border="0" height="181" cellspacing="0" cellpadding="0">

<tr valign="top">

<td colspan="2"> <div align="center"><br><hr color="#FFFFFF" size="1">

<font face="Arial"><a class=menu><font color="#FFFFFF" size="4">Vendas</font></a></font><br>

<hr color="#FFFFFF" size="1"><br>

<font color="#CCFFFF">TELE VENDAS: 0800-xxxxxxx</font><br>

<br>

<font color="#CCFFFF">Preencha o formul&aacute;rio a baixo</font></div>

<form method="post" action="mailto:mail@provedor.com.br?subject=FORMULARIO DE VENDAS" enctype="text/plain"

style="border-style: solid; border-color: #408CC8" name="vendas" onSubmit="java script: return liberar()">

<table width="434" height="157" cellpadding="2" cellspacing="0" bgcolor="#4070B0">

<tr>

<td width="200" height="15"><a class=texto><font color="#FFFFFF">Empresa:</font><br></a>

<input type= " text " name=" empresa " size="40" maxlength="30"></td>

</tr><tr>

<td><font color="#FFFFFF">Ramo de Atividade:</font><br>

<input type= " text " name=" ramo " size="35" maxlength="30"></td>

</tr><tr>

<td colspan="2"><font color="#FFFFFF">Nome do representante:</font><br>

<input type= " text " name=" nome " size="50" maxlength="50"></td>

</tr><tr>

<td><font color="#FFFFFF">Telefone:</font><br>

DDD<input type= " text " name=" ddd " size="3" maxlength="3">

Fone <input type= " text " name=" fone " size="8" maxlength="13"></td>

<td><font color="#FFFFFF">e-mail:</font><br>

<input type= " text " name=" email " size="20" maxlength="50"></td>

</tr><tr>

<td colspan="2"><font color="#FFFFFF">Endere&ccedil;o:</font><br>

<input type= " text " name=" endereço " size="62" maxlength="80"></td>

</tr> <tr>

<td ><font color="#FFFFFF">Bairro:</font><br>

<input type= " text " name=" bairro " size="30" maxlength="40"></td>

<td><font color="#FFFFFF">CEP:</font><br>

<input type= " text " name=" cep " size="9" maxlength="9"> (99999-999)</td>

</tr><tr>

<td><font color="#FFFFFF">Cidade:</font><br>

<input type= " text " name=" cidade " size="30" maxlength="40"></td>

<td width="163" height="22"><font color="#FFFFFF">Estado:</font><br>

<select name=" estado ">

<option>-------- Selecione --------

<option value= " ACRE ">ACRE

<option value= " ALAGOAS ">ALAGOAS

<option value= " AMAPA ">AMAPA

<option value= " AMAZONAS ">AMAZONAS

<option value= " BAHIA ">BAHIA

<option value= " CEARA ">CEARA

<option value= " DISTRITO FEDERAL ">DISTRITO FEDERAL

<option value= " ESPIRITO SANTO ">ESPIRITO SANTO

<option value= " GOIAS ">GOIAS

<option value= " MARANHÃO ">MARANHÃO

<option value= " MATO GROSSO ">MATO GROSSO

<option value= " MATO G. DO SUL ">MATO G. DO SUL

<option value= " MINAS GERAIS ">MINAS GERAIS

<option value= " PARA ">PARA

<option value= " PARAIBA ">PARAIBA

<option value= " PARANA ">PARANA

<option value= " PERNAMBUCO ">PERNAMBUCO

<option value= " PIAUI ">PIAUI

<option value= " RIO DE JANEIRO ">RIO DE JANEIRO

<option value= " RIO G. DO NORTE ">RIO G. DO NORTE

<option value= " RIO G. DO SUL ">RIO G. DO SUL

<option value= " RONDONIA ">RONDONIA

<option value= " RORAIMA ">RORAIMA

<option value= " SANTA CATARINA ">SANTA CATARINA

<option value= " SÃO PAULO ">SÃO PAULO

<option value= " SERGIPE ">SERGIPE

<option value= " TOCANTINS ">TOCANTINS

</select>

</td>

<tr>

<td colspan="2">

<font color="#FFFFFF">Observa&ccedil;&otilde;es:</font><br>

tarea name=" obs " rows="7" cols="55">

</textarea><br><br>

<center><input type="submit" value=" ENVIAR ">&nbsp&nbsp;

<input type="reset" value=" LIMPAR "></center>

<td width="218"> </tr>

</table>

</form>

</td>

</tr>

</table>

<font color="#CCFFFF"> * antes do envio, preencha todos os

campos do formul&aacute;rio *</font><br><br>

</td>

</tr>

</table>

</body>

</html>

Link para o comentário
Compartilhar em outros sites

  • 0

cara,eu dei uma arrumada,antes de você mandar esse código enorme,ficou assim:

<html>

<script language="JavaScript">

function liberar() {

  if (document.vendas.nome.value !=""){

    if (document.vendas.nome.value.length < 5){

      alert("Por Favor preencha Seu nome Completo.");

      document.vendas.nome.focus();

      return false;

    }

  }else {

    alert("Por Favor preencha seu nome.");

    document.vendas.nome.focus();

    return false;

  }

}

</script>

<body>

<form name="vendas" onsubmit="return liberar()">

<input type="text" name="nome">

<input type="submit" value="OK">

</form>

</body>

<html>

Link para o comentário
Compartilhar em outros sites

  • 0
cara,eu dei uma arrumada,antes de você mandar esse código enorme,ficou assim:
<html>

<script language="JavaScript">

function liberar() {

  if (document.vendas.nome.value !=""){

    if (document.vendas.nome.value.length < 5){

      alert("Por Favor preencha Seu nome Completo.");

      document.vendas.nome.focus();

      return false;

    }

  }else {

     alert("Por Favor preencha seu nome.");

     document.vendas.nome.focus();

     return false;

  }

}

</script>

<body>

<form name="vendas" onsubmit="return liberar()">

<input type="text" name="nome">

<input type="submit" value="OK">

</form>

</body>

<html>

Valeu cara depois dessa arrumada no código ele funcionou, valeu

Link para o comentário
Compartilhar em outros sites

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
      652k
×
×
  • Criar Novo...