Buneo nadie responde.... bien he encontrado la solución la pongo aquí por si alguien la necesita...
encontre el código para localizar la posición de la selección dentro del texto en esta web.....
http://the-stickman.com/web-developm...rnet-explorer/
luego pongo el código aquí el que me funciona, de momento solo funciona en Internet Explorer pero seguire buscando para que funcione en FireFox y Chrome.
var sel=document.selection.createRange ()
var texto1=sel.text;
var texto=sel.text;
if (texto=='')
{
var
texto='';
texto='<strong>'+texto+'</strong>';
}
var
tit=document.getElementById('areatxt');
var pilla=tit.childNodes[0].nodeValue;
// The current selection
var sel = document.selection.createRange();
// We'll use this as a 'dummy'
var stored_range = sel.duplicate();
// Select all text
stored_range.moveToElementText( tit );
// Now move 'dummy' end point to end point of original range
stored_range.setEndPoint( 'EndToEnd', sel );
// Now we can calculate start and end points tit.selectionStart = stored_range.text.length - sel.text.length; tit.selectionEnd = tit.selectionStart + sel.text.length;
var fin=sel.selectionEnd = tit.selectionStart + sel.text.length;
var inicio=sel.selectionStart = stored_range.text.length - sel.text.length;
var sTexto = pilla.substring(0, inicio) + texto + pilla.substr(fin);
tit.childNodes[0].nodeValue=sTexto;
si alguien sabe como hacer que funcione en firefox y chrome, se agradece.