you could observe a mouseup event on each div, and bind the following method to it:
var endpoint = null
function getselected(event){
endpoint = event.target;
var t = '';
if(window.getSelection){
t = window.getSelection();
}else if(document.getSelection){
t = document.getSelection();
}else if(document.selection){
t = document.selection.createRange().text;
}
return t;
}
this method will then return the selected text, it will tell you that the selection process ended on the div that fired the event. if you need the startpoint to, you have to bind a mousedown event to the divs, that will store the elements id in a variable, so you can determine the start- and endpoint of the selection process and find out which divs lie in between.
var startpoint = null;
function beginSelection(event){
startpoint = event.target;
}
if the getSelected-method returns an empty string, you should reset start- and endpoint.