Ver Mensaje Individual
  #3 (permalink)  
Antiguo 24/03/2013, 13:36
Avatar de temerariomalaga
temerariomalaga
 
Fecha de Ingreso: marzo-2013
Ubicación: Londres
Mensajes: 156
Antigüedad: 11 años, 2 meses
Puntos: 9
Respuesta: Error validación de formulario

Gracias por la respuesta, lo he probado de nuevo y sigue sin funcionar, este formulario está siendo un desastre porque ni se valida ni se envia
dejo aqui el codigo entero de la web por si el fallo se encuentra en otra parte.
Código HTML:
<!DOCTYPE HTML PUBLIC"-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/html4/loose.dtd">
<html>
<head>
	<title>Contacto - Representaciones Jesús Suviri</title>
	<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" >
	<meta name="author" content="Abel Suviri">
	<meta name="keywords" content="baño, ducha, grifo, mampara, representaciones, suviri">
	<link rel="stylesheet" type="text/css" href="style.css">
	<script type="text/javascript">
		function validacion(){
			nombre = document.getElementById("nombre").value;
			email = document.getElementById("email").value;
			asunto = document.getElementById("asunto").value;
			mensaje = document.getElementById("mensaje").value;
			var formato = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
			if(nombre==null || nombre.length==0 || /^\s+$/.test(nombre)){
				alert('[ERROR] El campo nombre está incompleto'); return false;
			}
			else if(!(formato.test(email)){
				alert('[ERROR] La dirección de email no es válida'); return false;
			}
			else if(asunto==null || asunto.length==0 || /^\s+$/.test(asunto)){
				alert('[ERROR] El campo asunto está incompleto'); return false;
			}
			else if(mensaje==null || mensaje.length==0 || /^\s+$/.test(mensaje)){
				alert('[ERROR] No ha introducido ningún mensaje'); return false;
			}
			return true;
		}
	</script>	
</head>
<body>
<div id="banner">
		<img src="images/banner.gif"></img>
	</div>
	<div id="menu">
		<ul>
			<li><a href="index.html">inicio</a>
			<li><a href="firmas.html">firmas</a>
			<li><a href="productos.html">productos</a>
			<li><a href="descargas.html">descargas</a>
			<li><a href="contacto.html">contacto</a>
		</ul>
	</div>	
	<div id="contacto">
		<h1>Jesús Suviri</h1>
		Telf. 610 725 255<br>
		Fax. 952 411 242<br>
		Mail: [email protected]<br>
		MÁLAGA
	</div>	
	<hr>
	<div id="formulario">
		<p>Puede contactar también rellenando el siguiente formulario con los datos solicitados.</p>
		<form name="formulario" action="envio.php" method="post" onsubmit="return validacion()">
			<table>
				<tr>
					<td>Nombre:</td>
					<td><input type="text" name="nombre" id="nombre" value="" size="50"/></td>
				</tr>
				<tr>
					<td>E-mail:</td>
					<td> <input type="text" name="email" id="email" value="" size="50"/></td>
				</tr>
				<tr>
					<td>Asunto:</td>
					<td><input type="text" name="asunto" id="asunto" value="" size="50"/></td>
				</tr>
				<tr>
					<td>Introduzca su mensaje:</td>
					<td><textarea cols="30" rows="10" ></textarea></td>	
				</tr>
				<tr>
					<td><input type="submit" value="Enviar"/><input type="reset" value="Limpiar"/></td>
				</tr>
			</table>
		</form>
	</div>	
	<div id="copyright">
	Diseñado por Abel Suviri ([email protected]) 
	</div>
</body>
</html> 
__________________
Málaga Club de Fútbol: Memoria, Compromiso, Fe