div和滚动条移动

div跟滚动条移动function getScroll() {var t, l, w, hif (document.documentElement && document.docume

div跟滚动条移动

 function getScroll() {         var t, l, w, h;         if (document.documentElement && document.documentElement.scrollTop) {             t = document.documentElement.scrollTop;             l = document.documentElement.scrollLeft;             w = document.documentElement.scrollWidth;             h = document.documentElement.scrollHeight;         }         else if (document.body) {             t = document.body.scrollTop;             l = document.body.scrollLeft;             w = document.body.scrollWidth;             h = document.body.scrollHeight;         }         return { t: t, l: l, w: w, h: h };     }     window.onscroll = function() {         var v = getScroll();         var e = document.getElementById("timediv");         e.style.position = "absolute";         e.style.top = v.t;  //纵滚动条离顶部距离         e.style.left = "1140px";  //离左端距离                            }