
16/10/2009, 14:51
|
| | Fecha de Ingreso: julio-2004
Mensajes: 44
Antigüedad: 20 años, 7 meses Puntos: 0 | |
Respuesta: document.selection no funciona en firefox AQUI ESTA LA SOLUCION:
function copyit(theField) {
// si es firefox o crone
if (window.getSelection)
{
var txt = window.getSelection();
ranges = [];
for(var i = 0; i < txt.rangeCount; i++) {
ranges[i] = txt.getRangeAt(i);
//sel.getRangeAt(i).deleteContents();
var acu = ranges[i];
}
theField.value = acu;
}
// si es safari (no le he probado)
else if (document.getSelection)
{
txt = document.getSelection();
foundIn = 'document.getSelection()';
}
// si es internet exploter
else if (document.selection)
{
var txt = document.selection.createRange();
theField.focus();
theField.value = txt.text;
}
} |