Dear Friend,
function disp()
{
var text = document.getElementById("text").value;
var t = text.substr(text.selectionStart,10);
alert(t+"\nSelectionStart:"+text.selectionStart);
}
<INPUT type="button" id="text" name="text" value="Select text and click here" onclick="disp()"/>
Hope this will fulfill your requirement.