As shown below:
//Return array type
function findPosition(oElement) {//oElement current element
if (typeof (oElement.offsetParent) != 'undefined') {
for (var posX = 0, posY = 0; oElement; oElement = oElement.offsetParent ) {
posX = oElement.offsetLeft;
posY = oElement.offsetTop;
}
}
var array = [posX, posY];
return array;
// Get the absolute X coordinate of the control that triggered the event in the entire page
function findPositionX(oElement) {
var posX = 0; oElement; oElement = oElement.offsetParent)
}
return posX; The absolute Y coordinate of the control that triggered the event on the entire page
function findPositionY(oElement) {
if (typeof (oElement.offsetParent) != 'undefined') {
for (var posY = 0; oElement ; oElement = oElement.offsetParent) {
}
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn