说明:本代码目前只在谷歌 和 IE 下做过测试,如有兴趣,希望大家能在更多的浏览器测试,并提出更多的宝贵意见,共同学习!
注意:本代码是在基于iframe框架的基础上做的,有与后台的互动,js、html 则是部分代码
js:
/**
* 固定表头(兼容IE)*/
function resetTableWidth(){
if(_maxPageDataNum >10)
{
if($("#tempHeader").length == 0)
{
$("#data-list").wrap('<div id="fixedTal" style="overflow:auto;height:367px;"></div>');
$("#fixedTal").before('<div id="tempHeader" style="overflow-x:auto;margin-right:20px; display:none;"><table class="common-table"><thead>'+$("#data-list thead").html()+'</thead></table></div>');
}
if($("#fixedTal").find("thead tr").css("display") == "none"){
$("#fixedTal").css("margin-top", "0").find("thead tr").removeClass("hiddenC");
}
var obj = {};