Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/11/2004, 00:40
LordCat
 
Fecha de Ingreso: octubre-2003
Ubicación: Buenos Aires, Capital Federal
Mensajes: 43
Antigüedad: 20 años, 6 meses
Puntos: 0
necesitas dos archivos
va el primero
//-------------------------------------------------------------
<html>
<head>
<title>Formulario de contacto</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../conf_estilos/default.css">
<script LANGUAGE="JavaScript">
<!-- Evita ek reenvio del formulario
var cuenta=0;
function enviado() {
if (cuenta == 0)
{
cuenta++;
return true;
}
else
{
alert("El siguiente formulario ya ha sido enviado, muchas gracias.");
return false;
}
}
// -->
</script>
<SCRIPT language=JavaScript>//--------------------------------------- VALIDA QUE LOS CAMPOS TENGAN ALGO Y EL MAIL TENGA @ Y PUNTO
function Validar(form)
{
document.form.Submit.value="Enviando mensaje.......";
document.form.Submit.disabled=true;

if (form.nombreyapellido.value == "")
{
document.form.Submit.value='Enviar consulta';
alert("Por favor ingrese su Nombre y Apellido");
form.nombreyapellido.focus();
document.form.Submit.disabled=false;
return;
}

if (form.telefono.value == "")
{
document.form.Submit.value='Enviar consulta';
alert("Por favor ingrese su telefono");
form.telefono.focus();
document.form.Submit.disabled=false;
return;
}

if (form.email.value == "")
{
document.form.Submit.value='Enviar consulta';
alert("Por favor ingrese su dirección de e-mail"); form.email.focus();
document.form.Submit.disabled=false;
return;
}
if (form.email.value.indexOf('@', 0) == -1 || form.email.value.indexOf('.com', 0) == -1)
{
document.form.Submit.value='Enviar consulta';
alert("Dirección de e-mail inválida");
form.email.focus();
document.form.Submit.disabled=false;
return;
}

if (form.comentarios.value == "")
{
document.form.Submit.value='Enviar consulta';
alert("Por favor ingrese un comentario");
form.comentarios.focus();
document.form.Submit.disabled=false;
return;
}
if (form.comentarios.value == "Ingrese aqui sus comentarios")
{
document.form.Submit.value='Enviar consulta';
alert("Por favor ingrese un comentario");
form.comentarios.focus();
document.form.Submit.disabled=false;
return;
}

form.submit();
}
</SCRIPT>
<script language="JavaScript"> //--------------------------------------------------- SOLO SE INGRESAN NUMEROS Y EL GUION MEDIO
var nav4 = window.Event ? true : false;
function acceptnum(evt){
// Nota: para saber los numeros de las teclas ver la tabla ASCII
var key = nav4 ? evt.which : evt.keyCode;
return (key <= 13 || key == 45 ||(key >= 48 && key <= 57));
}
</script>
<script language="JavaScript"> //--------------------------------------------------- SOLO SE INGRESAN LETRAS Y EL PUNTO
var nav4 = window.Event ? true : false;
function acceptletras(evt){
// Nota: para saber los numeros de las teclas ver la tabla ASCII
var key = nav4 ? evt.which : evt.keyCode;
return (key == 13 || key == 8 || key == 46 || key == 32 || (key >= 97 && key <= 122) || (key >= 65 && key <= 90));
}
</script>
<script language="JavaScript"> //--------------------------------------------------- SOLO CARACTERES PARA MAIL
var nav4 = window.Event ? true : false;
function acceptmail(evt){
// Nota: para saber los numeros de las teclas ver la tabla ASCII
var key = nav4 ? evt.which : evt.keyCode;
return (key == 13 || key == 64 || key == 95 || key == 45 || key == 8 || key == 46 || key == 32 || (key >= 97 && key <= 122) || (key >= 65 && key <= 90) || (key >= 48 && key <= 57));
}
</script>
<script language="JavaScript"> //--------------------------------------------------- PASO AL OBJETO[NEXT] SI PULSO ENTER
var nav4 = window.Event ? true : false;
function esenter(evt,numform,next){
var key = nav4 ? evt.which : evt.keyCode;
if (key == 13)
document.forms[numform].elements[next].focus();
}
//-->
</script>
<script language="JavaScript"> //--------------------------------------------------- BORRAR CONTENIDO SI ES LA PRIMERA VEZ
var first=0;
function borrarcontenido(campo){
if (first==0){
document.forms[0].elements[campo].value=''
first=1;
}
}
</script>
</head>
<body onLoad=this.form.nombreyapellido.focus()>
<form name="form" method="post" action="enviar.php" onSubmit="return enviado()">
<table width="400" border="1" align="center">
<tr>
<td>
<table width="100%" border="0" bgcolor="#d4d4d4">
<tr>
<td>Nombre y Apellido:</td>
<td><input name="nombreyapellido" type="text" onKeyPress="return acceptletras(event)" onKeyUp="return esenter(event,0,1)" size="40"></td>
</tr>
<tr>
<td>Tel&eacute;fono:</td>
<td><input name="telefono" type="text" onKeyPress="return acceptnum(event)" onKeyUp="return esenter(event,0,2)" size="40"></td>
</tr>
<tr>
<td>Correo Electr&oacute;nico:</td>
<td><input name="email" type="text" onKeyPress="return acceptmail(event)" onKeyUp="return esenter(event,0,3)" size="40"></td>
</tr>
<tr>
<td>Comentarios:</td>
<td><textarea name="comentarios" cols="50" rows="5" onFocus="borrarcontenido(3)">Ingrese aqui sus comentarios</textarea></td>
</tr>
</table>
</td>
</tr>
</table>
<div align="center"><br>
<input type="button" name="Submit" value="Enviar consulta" onclick=Validar(this.form) >
</div>
</form>
</body>
</html>