Ver Mensaje Individual
  #3 (permalink)  
Antiguo 08/05/2008, 07:52
pedro_cesar
 
Fecha de Ingreso: septiembre-2006
Mensajes: 328
Antigüedad: 17 años, 7 meses
Puntos: 3
Re: Cursor en Area de Texto

Gracias c_keeper, Selection.getBeginIndex () fue casi toda la solucion, este es el codigo:

Código:
telefono_ta.addEventListener("change", printear);

function printear () {
    if ((telefono_ta.length == 3 && (! telefono_ta.indexOf("-")))
         || (telefono_ta.length == 7 && (telefono_ta.indexOf("-") == telefono_ta.lastIndexOf("-"))))
      telefono_ta.text += "-";
      Selection.setSelection(telefono_ta.length, telefono_ta.length);
}
Aunque no la use en el codigo, fue haciendole el trace a ella y buscando algo mas de la seleccion que hice eso, no se si ponerle un if antes del setSelection () para verificar que haya que hacerlo, por que no se que tantos recursos me ahorre, ya que el if tendria que llevar a cabo una operacion quiza un tanto complicada tambien (seria el getBeginIndex ()).