
06/07/2011, 00:05
|
| | Fecha de Ingreso: julio-2011
Mensajes: 7
Antigüedad: 13 años, 9 meses Puntos: 0 | |
¿2 eventos en un onkeypress? buenas, tengo el siguiente problema quiero poner dos onkeypress pero solo funciona una este es mi codigo:
<script>
function tabular(e,obj) {
tecla=(document.all) ? e.keyCode : e.which;
if(tecla!=13) return;
frm=obj.form;
for(i=0;i<frm.elements.length;i++)
if(frm.elements[i]==obj) {
if (i==frm.elements.length-1) i=-1;
break }
frm.elements[i+1].focus();
return false;
}
</script>
<script type="text/javascript">
function validar(e) {
tecla = (document.all) ? e.keyCode : e.which;
if (tecla==8) return true;
patron =/[A-Za-z]/; // Solo acepta letras
te = String.fromCharCode(tecla);
return patron.test(te);
}
</script>
en el campo texto tengo esto:
<input type="text" style="background-color:#D9EEF2"onfocus="this.style.background=('#FC 6')" onblur="this.style.background=('#D9EEF2')" onkeypress="return tabular(event,this)&& return validar(event)" name="Nombres" id="Nombres" />
<br />
<label for="Apellidos">Apellidos:<br />
</label>
<input type="text" style="background-color:#D9EEF2" onfocus="this.style.background=('#FC6')" onblur="this.style.background=('#D9EEF2')"onkeypre ss="return tabular(event,this)&& return validar(event)" name="Apellidos" id="Apellidos" />
no me funciona la parte de onkeypress solo funciona un evento.¿
que puedo hacer?
tambien he probado colocando esto : onkeypress="return validar(event);return tabular(event,this). |