no ejecuta la funcion bien :S, e puesto lo siguiente
Código HTML:
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function fecha(idCampo){
var datePat = /^(0[1-9]|1\d|2\d|3[1-2])\/(0[1-9]|1[0-2])\/\d{4}$/;
if (matchArray != null){
document.getElementById(idCampo).style.color="#000 ";
} else{
document.getElementById(idCampo).style.color="#f00 ";
}
</SCRIPT>
</head>
<body>
<input type="text" id="acomprobar" onkeypress="fecha('acomprobar')"/>
</body>
</html>