Ver Mensaje Individual
  #3 (permalink)  
Antiguo 31/05/2010, 12:22
sysrj
 
Fecha de Ingreso: abril-2010
Mensajes: 23
Antigüedad: 14 años, 1 mes
Puntos: 0
Respuesta: Ayuda javascript regex

Me sigue saliendo el mismo error ya lo modificque tal y como me dices con otra barra invertida pero no me da nada mira este es el codigo html

<html>
<head>
<title>expresiones regulares</title>
<SCRIPT SRC="regex.js" TYPE="text/javascript"></SCRIPT>
</head>
<body>
<form name="formulario" action="recoger_datos.php" onSubmit="return ValidaCampos(this)">
DNI:<input type="text" name="dni" size="9" maxlength="9" /><br />
Teléfono: <input type="text" name="telefono" size="9" maxlength="9" /><br />
Nombre: <input type="text" name="nombre" maxlength="10" /><br />
Fecha:<input type="text" name="fecha" maxlength="10" /><br />
RFC:<input type="texto" name="rfc" maxlength="13" /><br />
<input type="submit" value="Enviar" name="enviar" />
</form>
</body>
</html>

Este es el codigo .js de java script


function ValidaCampos(formulario) {

var regexrfc = /^[A-Z]{4}\d{6}\\[a-zA-Z0-9]{3}$/;


if(regexrfc.test(formulario.rfc.value)==false)
{
alert("El RFC no es valido");
return false;
}

alert('Gracias por rellenar nuestro formulario correctamente.');
return true;
}