Hello, Massimiliano For the first, i don't see a reason for using this === if(document.selection) var _obj = DocumentSelection.insertAtCursor($("#target").get(), _text, true); else $("#target").insertAtCaret(_text); === Why not to use the single library for all tasks? And second, you explicitly define "#target" to put the selection in. You have to catch the focus event and then use the focused input. Friday, March 6, 2009, 4:56:51 PM you wrote: MB> On Fri, Mar 6, 2009 at 1:01 PM, Ilya S. Lebedev <ilya@xxxxxxxxxxx> wrote: MB> Hello, Massimiliano MB> All you need to do is store the selection coordinates on the dialog MB> open, then restore them on action. MB> The easiest way to handle this is using my DocumentSelection library: MB> http://svn.debugger.ru/repos/jslibs/BrowserExtensions/trunk/documentselection.js MB> It successfully tracks all the oddities of the Internet Explorer. MB> If you'd like to extract only the selection calculation code, search MB> for the "-100000000" substring and take the whole function from there. MB> I'd use your library but I have a problem with it (I don't know where I'm wrong or so). MB> A little test is here MB> http://maxb.net/scripts/dokuwiki/caret/test.html MB> if you want to look at it. MB> thanks in advance MB> Max -- Ñ óâàæåíèåì, Ilya mailto:ilya@xxxxxxxxxxx -- DokuWiki mailing list - more info at http://wiki.splitbrain.org/wiki:mailinglist