javascript - Code to find absolute position of an element of DOM in Java -
i working on project in java . in project, have find absolute position of element of dom. don't know how this. i searched on net, found same javascript. found here . code this , function getposition(element) { var xposition = 0; var yposition = 0; while(element) { xposition += (element.offsetleft - element.scrollleft + element.clientleft); yposition += (element.offsettop - element.scrolltop + element.clienttop); element = element.offsetparent; } return { x: xposition, y: yposition }; } when try write code in java, offsetleft, offsettop variable not found. can tell me, how can write code in java? edit no. 1 is there method using jsoup same? there 2 methods giving position in jsoup: element.elementsiblingindex() node.siblingindex() (you can count of childs too) but there's no offsetleft or offsettop in jsoup