Ver Mensaje Individual
  #2 (permalink)  
Antiguo 13/12/2018, 09:19
Avatar de dAvidcA
dAvidcA
 
Fecha de Ingreso: septiembre-2009
Ubicación: /home/dev/
Mensajes: 73
Antigüedad: 14 años, 7 meses
Puntos: 7
Respuesta: Rutina para saltar con ENTER

Hola, tal vez llego tarde, pero hace mucho no me conectaba. De igual forma hice este código más simple y funcional:

Código Javascript:
Ver original
  1. function tabular(e,obj)  
  2. {
  3.     tecla=(document.all) ? e.keyCode : e.which;
  4.     if(tecla!=13) return;
  5.     focusSiguiente(e.target.nextSibling);
  6.    
  7.     e.preventDefault();
  8.     return false;
  9. }
  10.  
  11. function focusSiguiente(sibling){
  12.     if (sibling === undefined) return; 
  13.    
  14.     let objSib = sibling.nextSibling;
  15.     if (objSib.readOnly || objSib.hidden || objSib.disabled){
  16.         focusSiguiente(objSib.nextSibling);
  17.         return;
  18.     }  
  19.     objSib.focus();
  20.     objSib.setSelectionRange(0, objSib.value.length);
  21. }

Saludos.