A simple example: Determine whether the mouse is on the left or right side of the event source, which is commonly used in automatic page turning when clicking on a picture.
function GetMousePosStr (evnt,ele)
{
if(!evnt)
{
evnt = window.event;
}
var offsetX = evnt.offsetX ? evnt.offsetX : evnt.layerX;
if(evnt.offsetX < ele.offsetWidth / 2)
{
return 'left';
}
else
{
return 'right';
}
}