//获取元素の位置
function getLeft(obj) {
if (obj == null)
return null;
var mendingObj = obj;
var mendingLeft = mendingObj.offsetLeft;
while (mendingObj != null && mendingObj.offsetParent != null && mendingObj.offsetParent.tagName != "BODY") {
mendingLeft = mendingLeft mendingObj.offsetParent.offsetLeft;
mendingObj = mendingObj.offsetParent;
}
return mendingLeft;
};
function getTop(obj) {
if (obj == null)
return null;
var mendingObj = obj;
var mendingTop = mendingObj.offsetTop;
while (mendingObj != null && mendingObj.offsetParent != null && mendingObj.offsetParent.tagName != "BODY") {
mendingTop = mendingTop mendingObj.offsetParent.offsetTop;
mendingObj = mendingObj.offsetParent;
}
return mendingTop;
};
//获取ネズミ标の位置
function getMousePosition(event) {
var Position = {
MouseX: 0,
MouseY: 0
}
if (event.pageX != 未定義) {
position.MouseX = events.pageX;
位置.マウスY = イベント.ページY;
}
else {
var target = EventUtil.getTarget(event);
position.MouseX =event.offsetX getLeft(target);
position.MouseY =event.offsetY getTop(target);
}
位置を戻します。