In addition to the top topic, there is an official way to implement what I think you want in the DOM. What you can use instead of events is called a range object.
Let's consider (what finally works on FF3)
window.onclick = function (evt)
{
// retrieves the selection and displays its content
var selectObj = window.getSelection ();
alert (selectObj);
// now collapse the selection to the initial point of the selection
var rangeObj = selectObj.getRangeAt(0);
rangeObj.collapse(true);
}
, IE, Opera, Chrome Safari; , Opera, Chrome Safari -, collapse getRangeAt. , .
, , - , collapseToStart, collapseToEnd. ( )
2.0 :
window.onmouseup = function(evt)
{
var selectObj = window.getSelection();
alert(selectObj); // to get a flavor of what you selected
// works in FF3, Safari, Opera, and Chrome
selectObj.collapseToStart();
// works in FF3, Safari, Chrome (but not opera)
/* selectObj.collapse(document.body, 0); */
// and as the code is native, I have no idea why...
// ...and it makes me sad
}