Jump to content


Photo

Checar Campos


  • Faça o login para participar
1 reply to this topic

#1 fallback

fallback

    12 Horas

  • Usuários
  • 127 posts
  • Sexo:Não informado
  • Interesses:Tudo o k é Informatica

Posted 29/12/2007, 11:56

Boa tarde, ajudem-me nesse codigo, colokei pa ele checar os campos em branco mas nao aconteçe o k ta de errado?

[codebox]<html>
<head>
<title>Contacto</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
.td {
font-family: Tahoma, Verdana, Arial;
font-size: 10pt;
font-weight: bold;
color: #333333;
}
.tdform {
font-family: Tahoma, Verdana, Arial;
font-size: 8pt;
font-weight: normal;
color: #333333;
letter-spacing: 1px;
}
.form {
font-family: Tahoma, Verdana, Arial;
font-size: 8.5pt;
color: #333333;
background-color: #F7F7F7;
}
.style3 {
font-size: small;
text-align: left;
}
.style4 {
font-family: Tahoma, Verdana, Arial;
font-size: small;
color: #333333;
background-color: #F7F7F7;
}
.style5 {
text-align: center;
}
.style6 {
font-size: medium;
font-family: Arial;
}
.style7 {
color: #0000FF;
}
.style8 {
text-align: left;
}
.novoEstilo1 {
background-color: #C0C0C0;
}
-->
</style>
<script LANGUAGE=javascript>
<!--
function envia()
{
if((form1.nome.value=="") || (form1.email.value=="") ||(form1.telefone.value=="") ||(form1.assunto.value=="") ||(form1.mensagem.value==""))
{
alert("Todos os campos tem que ser preenchidos");
}
else
{
form1.submit();
}
}

//-->
</SCRIPT>

</head>

<body>
<table align="center" border="0" cellspacing="2" cellpadding="2" style="width: 63%; height: 652px;">
<tr>
<td class="style5">
<img src="../images/FILTRAX%20-%20LOGO%20DEFINITIVO%20jpg.jpg" width="283" height="149"><br>
</td>
</tr>
<tr>
<td><form name="form1" method="post" action="enviar.php">
<div class="style5">
<span class="style6"><br>
<span class="style7">Deixe-nos a sua opinião ou qualquer tipo de
esclarecimento de dúvidas<br>
&nbsp;sobre os nossos Purificadores<br>
</span></span><br>
</div>
<table width="100%" border="0" cellpadding="2" cellspacing="2" class="tdform">
<tr>
<td width="9%" class="style3" style="height: 36px"><strong>Nome:</strong></td>
<td width="91%" style="height: 36px" class="style8">
<input name="nome" type="text" class="form" id="nome" value="" maxlength="90" style="width: 194px"></td>
</tr>
<tr>
<td class="style3" style="height: 36px"><strong>Email:</strong></td>
<td style="height: 36px" class="style8">
<input name="email" type="text" class="form" id="email" maxlength="90" style="width: 194px"></td>
</tr>
<tr>
<td class="style3" style="height: 36px"><strong>Telefone:</strong></td>
<td style="height: 36px" class="style8">
<input name="telefone" type="text" class="form" id="telefone" maxlength="20" style="width: 194px"></td>
</tr>
<tr>
<td class="style3" style="height: 36px"><strong>Assunto:</strong></td>
<td style="height: 36px" class="style8">
<input name="assunto" type="text" class="form" id="assunto" maxlength="300" style="width: 194px"></td>
</tr>
<tr>
<td class="style3" style="height: 71px"><strong>Mensagem:</strong></td>
<td style="height: 71px" class="style8">
<textarea name="mensagem" class="form" id="mensagem" style="width: 398px; height: 247px"></textarea></td>
</tr>
<tr>
<td><input name="Submit" type="submit" class="style4" value="Enviar" onclick="return envia()></td>
<td><input name="Limpar" type="reset" class="style4" id="Limpar" value="Limpar"></td>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>[/codebox]


Obs.: utilizei a busca.

o botao limpar do form desapareceu...

Edição feita por: fallback, 29/12/2007, 11:57.


#2 offspring

offspring

    O_o

  • Ex-Admins
  • 946 posts
  • Sexo:Masculino
  • Localidade:São Paulo - SP

Posted 03/01/2008, 08:47

faltou um return false; em caso de erro e faltou a aspa no onclick="return envia()




0 user(s) are reading this topic

0 membro(s), 0 visitante(s) e 0 membros anônimo(s)

IPB Skin By Virteq