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