Ver Mensaje Individual
  #1 (permalink)  
Antiguo 03/01/2008, 13:39
Avatar de FuLaNo_
FuLaNo_
 
Fecha de Ingreso: mayo-2003
Ubicación: Don Torcuato, Buenos Aires, Argentina
Mensajes: 1.250
Antigüedad: 21 años, 9 meses
Puntos: 2
Problema con substr en IE

Hola gente, tengo este codigo:

Código:
function bbc_openForm(form, name, code) {
	txtarea = document.forms[form][name];
	txtareavalue = txtarea.value;
	textSelectionStart = txtarea.selectionStart;
	textSelectionEnd = txtarea.selectionEnd;
	var isSelected = txtareavalue.substr(textSelectionStart, textSelectionEnd - textSelectionStart);
	if (!isSelected) {
		uri = 'extra/format.php?form=' +form+ '&name=' +name+ '&code=' +code;
		if (code == "url" || code == "urlinternal") { window.open(uri,"","width=450,height=157,top=90"); }
		else if (code == "image") { window.open(uri,"","width=450,height=263,top=90"); }
		else if (code == "colour") { window.open(uri,"","width=450,height=100,top=90"); }
		else { window.open(uri,"","width=450,height=100,top=90"); }
	}
	else { 
		bbc_addObjet(form, name, code, '', '', '',1)
	}
}
El problema es el siguiente:

la variable isSelected deberia devolver la cantidad de caracteres SELECCIONADOS en un textarea, en Firefox funciona excelente, pero en IE no y, por ende, siempre ejecuta la acción del "else"

He probado varios "arreglos" que encontre en la Red, pero ninguno funcionó.. estoy hace varias horas buscando e intentando solucionarlo pero bueno...

Espero alguien pueda darme una mano

Saludos!
__________________
I Love Programming...