仿淘宝提示窗口 function getPosXY(a, offset) { var p = offset ? offset.slice(0) : [0,0],tn; while (a) { tn = a.tagName.toUpperCase(); p[0] += a.offsetLeft - (tn == "DIV" && a.scrollLeft ? a.scrollLeft : 0); p[1] += a.offsetTop - (tn == "DIV" && a.scrollTop ? a.scrollTop : 0); if (tn == "BODY") break; a = a.offsetParent; } return p; }