解决IE不支持position:fixed问题
//样式<style>.tr-fixed-ff { position: fixed; left: 1%; top: 0px; width: 98%; /* IE6改为绝对定位,并通过css表达式根据滚动位置更改top的值 */_position: absolute;_top: expression(eval(document.documentElement.scrollTop));}.tr-fixed-ie { position: fixed; left: 1%; top: 0px; /* IE6改为绝对定位,并通过css表达式根据滚动位置更改top的值 */_position: absolute;_top: expression(eval(document.documentElement.scrollTop));}</style>//脚本<script type="text/javascript">//判断浏览器的脚本,直接修改别人的代码,拿来主义哈哈。function getOs(){ var OsObject = ""; if(navigator.userAgent.indexOf("MSIE")>0) { return "MSIE"; } if(isFirefox=navigator.userAgent.indexOf("Firefox")>0){ return "Firefox"; } }//使用jquery,对我要进行浮动的table里面的第一行进行样式的添加和移除。$(document).ready(function(){$(window).scroll( function() { if($(window).scrollTop()>=95){//第一行tr相距top的距离为95if(getOs() == "MSIE"){$("#tr_scroll").addClass("tr-fixed-ie");} else{$("#tr_scroll").addClass("tr-fixed-ff");}} else{if(getOs() == "MSIE"){$("#tr_scroll").removeClass("tr-fixed-ie");} else{$("#tr_scroll").removeClass("tr-fixed-ff");}}});});</script><body><table id="tr_scroll" width="100%" border="0" align="center" cellpadding="0" cellspacing="1" align="center"> <td width="7%">日期</td> <td width="24%" height="20">工作任务</td> <td width="5%">任务说明</td> <td width="6%">分配人</td> <td width="9%" />
浮动后:
个人测试过了,在IE6和火狐下没问题。