У меня есть javascript, подобный
function getCursorPosition(e) {
e = e || window.event;
var cursor = {x:0, y:0};
if (e.pageX || e.pageY) {
cursor.x = e.pageX;
cursor.y = e.pageY;
}
else {
cursor.x = e.clientX +
(document.documentElement.scrollLeft ||
document.body.scrollLeft) -
document.documentElement.clientLeft;
cursor.y = e.clientY +
(document.documentElement.scrollTop ||
document.body.scrollTop) -
document.documentElement.clientTop;
}
return cursor;
}
document.onmouseup = function(e){
cursor = getCursorPosition();
alert(cursor.x + ':' + cursor.y);
};
, этот код предупреждает положение X и Y, где нажат курсор.Это хорошо работает в IE 7/8, Chrome / Safari, Opera 10.Но при тестировании с Firefox 4.0 beta 1 он не работает.
При поиске в Google многие сайты давали мне один и тот же код.Но он не работает в ff 4.0b
Это ошибка в ff 4.0b?или кто-нибудь может предложить мне другой кросс-браузерный скрипт позиционирования курсора?