Ver Mensaje Individual
  #3 (permalink)  
Antiguo 16/12/2010, 13:30
vandyk26
 
Fecha de Ingreso: diciembre-2007
Mensajes: 81
Antigüedad: 16 años, 5 meses
Puntos: 0
Respuesta: Validacion de e-mail

Gracias, pero no se muy bien que funcion tengo que usar para validar el e-mail,aunque se algo de programacion no se me ocurre como.

El formulario lo tengo de esta forma:
Código:
        <label for="mensaje" class="etiquetas_largas">Mensaje:</label>
         <textarea name="mensaje" id="mensaje" cols="45" rows="5"></textarea><br /><br />
         <label for="enviar"></label>
        <input name="Bot&oacute;n" type="button" class="boton_contacto" id="enviar" value="Enviar" onclick="validar();" />
O sea al hacer click en el boton del form se validan los datos.
La funcion validar:

Código:
<script type="text/javascript">
function validar(){
	var nombre=document.getElementById("nombre").value;
	var apellidos=document.getElementById("apellidos").value;
	var telefono=document.getElementById("telefono").value;
	var correo=document.getElementById("email").value;
	var asunto=document.getElementById("asunto").value;
	var mensaje=document.getElementById("mensaje").value;
	var error=""
	
	if (nombre=="" || apellidos=="" || !isNaN(nombre) || !isNaN(apellidos)){
		error="- Nombre y Apellidos vacios o no contienen texto \n";
	}
	if (telefono.length!=9 || telefono=="" || isNaN(telefono)){
		error=error+"- Telefono vacio o no tiene 9 cifras \n";
	}
	if (error!=""){
	    alert("SE HAN PRODUCIDO ERRORES,REVISALOS: \n"+error);
	}
}

</script>
Me podeis decir como es la funcion para validar el e.mail y donde meterla?

Gracias.