Foros del Web » Programando para Internet » Javascript »

Rellener Field focus

Estas en el tema de Rellener Field focus en el foro de Javascript en Foros del Web. Hola estoy desarrollando una EXTENSION para mozilla. Necesito que al hacer click en un boton, se agregue X texto a el ultimo FIELD/CAMPO ACTIVO! de ...
  #1 (permalink)  
Antiguo 05/09/2009, 15:38
Avatar de jamesjara  
Fecha de Ingreso: mayo-2008
Ubicación: san jose
Mensajes: 449
Antigüedad: 15 años, 11 meses
Puntos: 7
De acuerdo Rellener Field focus

Hola estoy desarrollando una EXTENSION para mozilla.

Necesito que al hacer click en un boton, se agregue X texto a el ultimo FIELD/CAMPO ACTIVO! de la pagina web.

Como logro eso?
tengo una idea debe ser asi
Código:
function fill(){
  var focused = LAST FOCUS ELEMENT IN THE HTML PAGE,OR ACTIVE TAB WEB;
  document.getElementById("focused").value .= "NEW VALUE";
}
<button label="add text to field" oncommand="fill()"/>
Es algo asi como un html WYSIGYW pero no es eso..
__________________
X7CLOUD El webservice latino!
Compatible
con mysql,sql,sqlitte.
Compatible con extjs , sencha , smargwt, Gwt , Jquery , Charts, Streaming.
  #2 (permalink)  
Antiguo 06/09/2009, 04:29
Avatar de jamesjara  
Fecha de Ingreso: mayo-2008
Ubicación: san jose
Mensajes: 449
Antigüedad: 15 años, 11 meses
Puntos: 7
Respuesta: Rellener Field focus

hellllllp plis
__________________
X7CLOUD El webservice latino!
Compatible
con mysql,sql,sqlitte.
Compatible con extjs , sencha , smargwt, Gwt , Jquery , Charts, Streaming.
  #3 (permalink)  
Antiguo 06/09/2009, 19:42
Avatar de America|UNK  
Fecha de Ingreso: noviembre-2006
Ubicación: Piura - Perú
Mensajes: 582
Antigüedad: 17 años, 4 meses
Puntos: 56
Respuesta: Rellener Field focus

Código HTML:
<script type="text/javascript">

var fill = function (){
var obj = document.getElementsByTagName("input");
var focused = obj[obj.length-1];
focused.value = "new value!!";
}
</script>

<input type="text" value="5" />
<input type="text" value="4" />
<input type="text" value="3" />
<input type="text" value="1" />

<button onClick="fill()">add text to field</button> 
__________________
/* El que atiende, entiende..., el que entiende, aprende!.
Desarrollo Web Freelance, Contactar */
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:32.