Foros del Web » Programando para Internet » Javascript »

Problema con sistema de tags en IE (estilo foros) ([b][/b])

Estas en el tema de Problema con sistema de tags en IE (estilo foros) ([b][/b]) en el foro de Javascript en Foros del Web. Que tal gente, tengo un problema en IE, cuando sombreo parte de un texto y aplico un tag utilizando esta funcion no lo encierra, en ...
  #1 (permalink)  
Antiguo 22/05/2009, 16:43
 
Fecha de Ingreso: marzo-2007
Mensajes: 340
Antigüedad: 17 años, 1 mes
Puntos: 4
Problema con sistema de tags en IE (estilo foros) ([b][/b])

Que tal gente, tengo un problema en IE, cuando sombreo parte de un texto y aplico un tag utilizando esta funcion no lo encierra, en ves de quedar algo como esto:

[b ]adasd[ /b]

queda asi:

[b ][ /b]adasd

en firefox, opera, etc no sucede.

Alguna idea de como puedo arreglarlo ? gracias.

Llamada:

Código:
<a href="#" onclick="applyDecos('tLongDesc', '', ''); return false;">Bold</a>
JS:

Código:
function applyDecos(eId, decoOpen, decoClose) {
	// Applies decorations brackets to the textbox
	// i.e: applyDecos("tMsg", "", "")
	
	mozWrap(document.getElementById(eId), decoOpen, decoClose); // Adding decos
	document.getElementById(eId).focus(); // Focusing textbox
	
	// If we didnt select but added them, then...
	if (document.getElementById(eId).selectionStart == document.getElementById(eId).selectionEnd) {
		// ... we set the cursor in the middle of both so we can write =)
		document.getElementById(eId).selectionStart = document.getElementById(eId).selectionStart - decoClose.length;
		document.getElementById(eId).selectionEnd = document.getElementById(eId).selectionStart;
	}
	
	return;
//	}
}

/*
* mozWrap From http://www.massless.org/mozedit/
*/
function mozWrap(txtarea, open, close)
{
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	var scrollTop = txtarea.scrollTop;

	if (selEnd == 1 || selEnd == 2) 
	{
		selEnd = selLength;
	}

	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);

	txtarea.value = s1 + open + s2 + close + s3;
	txtarea.selectionStart = selEnd + open.length + close.length;
	txtarea.selectionEnd = txtarea.selectionStart;
	txtarea.focus();
	txtarea.scrollTop = scrollTop;

	return;
}
function insertText(txtarea, data)
{
	var selLength = txtarea.textLength;
	var selStart = txtarea.selectionStart;
	var selEnd = txtarea.selectionEnd;
	var scrollTop = txtarea.scrollTop;

	if (selEnd == 1 || selEnd == 2) 
	{
		selEnd = selLength;
	}

	var s1 = (txtarea.value).substring(0,selStart);
	var s2 = (txtarea.value).substring(selStart, selEnd)
	var s3 = (txtarea.value).substring(selEnd, selLength);

	txtarea.value = s1 + data + s2 + s3;
	txtarea.selectionStart = selEnd + data.length;
	txtarea.selectionEnd = txtarea.selectionStart;
	txtarea.focus();
	txtarea.scrollTop = scrollTop;

	return;
}

function queryDecoURL(eId) {
	var url = prompt("URL", "http://");
	if (url.length > 0) {
		applyDecos(eId, "", "");
	}
}
  #2 (permalink)  
Antiguo 23/05/2009, 18:18
 
Fecha de Ingreso: marzo-2007
Mensajes: 340
Antigüedad: 17 años, 1 mes
Puntos: 4
Respuesta: Problema con sistema de tags en IE (estilo foros) ([b][/b])

Alguien ??????
  #3 (permalink)  
Antiguo 25/05/2009, 14:38
 
Fecha de Ingreso: marzo-2007
Mensajes: 340
Antigüedad: 17 años, 1 mes
Puntos: 4
Respuesta: Problema con sistema de tags en IE (estilo foros) ([b][/b])

nadieeee che ???
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 17:28.