/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function findPosition(obj) { var curleft = curtop = 0; if (obj.offsetParent) { do { curleft += obj.offsetLeft; curtop += obj.offsetTop; } while (obj = obj.offsetParent); } var arrPositions = new Array(); arrPositions[0] = curleft; // LEFT arrPositions[1] = curtop; // TOP return arrPositions; }