Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/10/2009, 08:19
tuweb
 
Fecha de Ingreso: julio-2004
Mensajes: 44
Antigüedad: 20 años, 7 meses
Puntos: 0
document.selection no funciona en firefox

Hola,

He intentado buscar equivalentes a document.selection para firefox pero no encuentro nada.

Básicamente solo quiero que al seleccionar un texto de una pagina el mismo se coloque en un campo de formulario.

alguna idea? . aquí les dejo mi código que funciona perfecto en IE.

function copyit(theField) {
var selectedText = document.selection;
if (selectedText.type == 'Text') {
var newRange = document.selection.createRange();
theField.focus();
theField.value = newRange.text;
} else {
alert('select a text in the page and then press this button');
}
}