function getoffset(e) {
var t = e.offsetTop; var l = e.offsetLeft; while (e = e.offsetParent) { t += e.offsetTop; l += e.offsetLeft; } var result = {}; result.offsetTop = t; result.offsetLeft = l; return result; }本文共 295 字,大约阅读时间需要 1 分钟。
function getoffset(e) {
var t = e.offsetTop; var l = e.offsetLeft; while (e = e.offsetParent) { t += e.offsetTop; l += e.offsetLeft; } var result = {}; result.offsetTop = t; result.offsetLeft = l; return result; }转载于:https://www.cnblogs.com/yuanxiaoping_21cn_com/archive/2013/04/28/3049529.html