As shown below:
Copy Code code as follows:
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;
}
Gets the absolute x-coordinate of the control that triggers the event on the entire page
function Findpositionx (oelement) {
if (typeof (Oelement.offsetparent)!= ' undefined ') {
for (var posx = 0; oelement; oelement = oelement.offsetparent)
{
Posx + = Oelement.offsetleft;
}
}
return POSX;
}
Gets the absolute y-coordinate of the entire page for the control that triggers the event
function Findpositiony (oelement) {
if (typeof (Oelement.offsetparent)!= ' undefined ') {
for (var posy = 0; oelement; oelement = oelement.offsetparent) {
Posy + = Oelement.offsettop;
}
}
return posy;
}