[Javascript] help in X-Browser caret POS pls...
Walter Torres
walter at torres.ws
Wed Apr 16 16:49:48 CDT 2003
George Zabanah graciously offer this little didly [see below] for general
use (thanks George!), but it is IE only.
Can anyone in here convert this to work with NN 6+ (4 would be nice, but...)
Opera, and the others?
I've not been having any luck on my end with it.
Thanks
Walter
// Copyright (C) George Zabanah April 8, 2003
// Please feel free to use this ... but leave this header on top
// 'bolStart' = true - return begining point of selection
// 'bolStart' = false - return ending point of selection
// If no select is made, then either will return current caret
// location
function ReturnCaretPOS ( bolStart )
{
var caretPos = window.document.selection.createRange().duplicate();
caretPos.collapse(bolStart);
caretPos.moveStart("textedit",-1);
return caretPos.text.length;
}
More information about the Javascript
mailing list