java excel 冻结_如何实现表格的首行冻结2

电脑医生-奉献 QQ:343907552

body {

background: #E6EAE9;

}

.fixedHeaderTr

{

z-index:10;

position:relative;

top:expression(this.offsetParent.scrollTop);

color:white;

background-color:#4f6b72;

font:  10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;

};

.fixedHeaderTd

{

color:white;

background-color:#4f6b72;

};

.relativeTag

{

font:  10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;

position:relative;

border:none;

border-bottom: 1px solid #CCCCCC;

border-right: 1px solid #CCCCCC;

};

.fixedHeaderCol

{

z-index:9;

background-color:#4f6b72;

position:relative;

left:expression(this.parentElement.offsetParent.scrollLeft);

color:white;

font:  12px "宋体", Verdana, Arial, Helvetica, sans-serif;

border:none;

border-bottom: 1px solid #CCCCCC;

border-right: 1px solid #CCCCCC;

};

.fixedHeaderCol_left

{

z-index:9;

background-color:#f2f3f7;

position:relative;

left:expression(this.parentElement.offsetParent.scrollLeft);

color:#000000;

font:  12px "宋体", Verdana, Arial, Helvetica, sans-serif;

border:none;

border-bottom: 1px solid #CCCCCC;

border-right: 1px solid #CCCCCC;

};

.mainDiv

{

overflow:auto;

scrollbar-face-color:9999ff;

height:expression((document.body.clientHeight-this.offsetTop-20>this.children[0].offsetHeight)?(this.children[0].offsetHeight+20) : (document.body.clientHeight-this.offsetTop-20));

width:expression(document.body.clientWidth-20);

}

.resizeDivClass

{

position:relative;

/*background-color:#4f6b72;*/

width:4;

z-index:100;

float:right;

left:2;

cursor:e-resize;

}

function MouseDownToResize(obj){

setTableLayoutToFixed();

obj.mouseDownX=event.clientX;

obj.pareneTdW=obj.parentElement.offsetWidth;

obj.pareneTableW=theObjTable.offsetWidth;

obj.setCapture();

}

function MouseMoveToResize(obj){

if(!obj.mouseDownX) return false;

var newWidth=obj.pareneTdW*1+event.clientX*1-obj.mouseDownX;

if(newWidth>0)

{

obj.parentElement.style.width = newWidth;

theObjTable.style.width=obj.pareneTableW*1+event.clientX*1-obj.mouseDownX;

}

}

function MouseUpToResize(obj){

obj.releaseCapture();

obj.mouseDownX=0;

}

function setTableLayoutToFixed()

{

if(theObjTable.style.tableLayout=='fixed') return;

var headerTr=theObjTable.rows[0];

for(var i=0;i

{

headerTr.cells[i].styleOffsetWidth=headerTr.cells[i].offsetWidth;

}

for(var i=0;i

{

headerTr.cells[i].style.width=headerTr.cells[i].styleOffsetWidth;

}

theObjTable.style.tableLayout='fixed';

}

自由拖动表格列宽,并且固定标题和首列(ACCESS数据库版)

固定表头

表头1    

表头2    

表头3    

表头4    

Header C    

Header C    

A011123沈惠沈惠 内贸业务员   

内贸业务员

销售

销售
A009123闫冬闫冬 内贸业务员   

内贸业务员

销售

销售
A044123许金飞许金飞 内贸业务员   

内贸业务员

销售

销售
C018123吕庆艳吕庆艳 档车工   

档车工

经编

经编
C027123蒲良娥蒲良娥 档车工   

档车工

经编

经编
D013123王为辉王为辉 操作工   

操作工

塑胶

塑胶
D015123赵刘勋赵刘勋 操作工   

操作工

塑胶

塑胶
D018123孙太鹏孙太鹏 操作工   

操作工

塑胶

塑胶
D020123王利辉王利辉 操作工   

操作工

塑胶

塑胶
D022123孟小伟孟小伟 操作工   

操作工

塑胶

塑胶
D025123畅会勇畅会勇 操作工   

操作工

塑胶

塑胶
D027123刘景高刘景高 操作工   

操作工

塑胶

塑胶
D038123陈德建陈德建 操作工   

操作工

塑胶

塑胶
D051123张三鱼张三鱼 操作工   

操作工

塑胶

塑胶
D054123徐燕武徐燕武 操作工   

操作工

塑胶

塑胶
D057123孙用全孙用全 操作工   

操作工

塑胶

塑胶
D058123陈玉昆陈玉昆 操作工   

操作工

塑胶

塑胶
D103123朱国亮朱国亮 操作工   

操作工

塑胶

塑胶
D080123周昌林周昌林 操作工   

操作工

塑胶

塑胶
G051123王忠强王忠强 操作工   

操作工

压延

压延
G056123陈利祥陈利祥 操作工   

操作工

压延

压延
G076123刘成龙刘成龙 操作工   

操作工

压延

压延
G077123张勋张勋 操作工   

操作工

压延

压延

var mydown = 0, myout = 0, tdID, clickedID, currentID, prevID; //Don't attempt to modify these variables

var fntcolor = "#333333", fntcolorhilite = "#333333"; //Font color on mouse over and out the td

var bgOver = "#CEE3FF", bgDown = "#CEE3FF", bgClickedout = "#CEE3FF", bgOut = ""; //Background color on mouse over, down, out after click, out without click

function getID(mytdID) { //Get current td ID on mouse over

tdID = mytdID;

currentID = document.all[mytdID];

currentID.bgColor = bgOver;

currentID.style.color = fntcolor;

}

function sC(clickID,myclick) { //Define ID that should be stored as last clicked td ID

mydown = myclick;

clickedID = clickID;

if ( prevID != null) {

prevID.bgColor = bgOut;

prevID.style.color = fntcolor;

}

else {

}

currentID.bgColor = bgDown;

}

function oC(myout) { //Detect whether the mouse is clicked or not

if (myout == 1 && mydown == 1) {

currentID.bgColor = bgClickedout;

currentID.style.color = fntcolorhilite;

prevID = document.all[clickedID];

mydown = 0;

}

else if (currentID == prevID) {

currentID.bgColor = bgClickedout;

currentID.style.color = fntcolorhilite;

}

else {

currentID.bgColor = bgOut;

}

}

发表于 2009-07-17 10:02 javaex 阅读(777) 评论(0)  编辑  收藏 所属分类: CSS

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值