Muchas gracias por la uyuda, lo resolvi a fin de cuentas abajo os pongo el código para el que le interese y le pueda servir.
Código:
function caja_color(opc,e,theForm) {
if(opc==1) {
var key=(document.all) ? e.keyCode : e.which;
if(key!=13) {
if(key!=32) {
theForm.style.backgroundColor='white';
theForm.style.color='black';
}
}
}
if(opc==2) {
theForm.style.backgroundColor='white';
theForm.style.color='black';
}
}
Y lo mando a llamar de la sig. manera:
Código:
<input type="text" name="nombre" size="35" onChange="borra_espacios(this)" onkeypress="caja_color(1,event,this)" onblur="caja_color(2,'NULL',this)" />
Saludos.