Hola
lisen
He modificado tu código, creo que te servirá:
Código:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
</head>
<script type="text/javascript">
function validar(frm){
patron = /\d{4}/;
return patron.test(frm.num.value);
}
</script>
<form method="post" name="formulario" id="formulario" onsubmit="return validar(this)">
<div align="center">
<p>BIENVENIDO</p>
<p>POR FAVOR INTRODUZCA SU NUMERO DE EMPLEADO</p>
<p>
<label>
<input type="text" maxlength="4" size="4" id="num" name="num"/>
</label>
<label>
<input type="submit" />
</label>
</p>
</div>
</form>
<form id="form1" name="form1" method="hidden" action="$result"><label></label></body>
</html>
Saludos,