简单的漂浮层
/*去除IE下抖动*/ *html{background-image:url(about:blank);background-attachment:fixed;} .piaofu { width: 158px; height: 413px; position: fixed; z-index: 1000; right: 35px; top: 100px; margin-top: 15px; /*IE6下浮动*/ _top: 150px; _position: absolute; _bottom: auto; _top: expression(eval(document.documentElement.scrollTop+120)); }
标头提示层或便捷功能菜单层:
<thead> <tr style="position: relative;top: expression((this.offsetParent.scrollTop>this.parentElement.parentElement.offsetTop?this.offsetParent.scrollTop-this.parentElement.parentElement.offsetTop-38:0)-1);"> <th class="tdcss" onclick="sortAble('tb',0,'int')"> 房间资料分析 </th> <th class="tdcss" colspan="4" onclick="sortAble('tb',1,'int')"> 本日统计 </th> <th class="tdcss" colspan="4" onclick="sortAble('tb',2,'int')"> 本月统计 </th> <th class="tdcss" colspan="4" onclick="sortAble('tb',3,'int')"> 本年统计 </th> </tr> </thead>
主要是此段代码:
<tr style="position: relative;top: expression((this.offsetParent.scrollTop>this.parentElement.parentElement.offsetTop?this.offsetParent.scrollTop-this.parentElement.parentElement.offsetTop-38:0)-1);" >
至少兼容IE8
<div class="divRight" style="position: relative;"> <div style="position: absolute;" id="divPosi"></div> </div>
/*右边漂浮层(checkbox是否漂浮,滚动到一定位置才漂浮)*/ window.onscroll = function () { var scrollTop = document.documentElement.scrollTop || document.body.scrollTop; if (document.getElementById("cbscroll").checked && scrollTop > 454) { document.getElementById("divPosi").style.top = (scrollTop - 454) + "px"; } else { document.getElementById("divPosi").style.top = 0; } }