目前的效果是这样实现的
<div id=the10Div style="height:400;overflow-x:hidden;overflow-y:auto;" onscroll= "the11Div.scrollTop=scrollTop " >
<table id=the10Table width='100%' cellspacing='1' border='0' cellpadding='0' style='background-color:#E4E5EE' >
......
</table></div></td><td>
<div id=the11Div style=' width:650;height:400;overflow-x:auto;overflow-y:hidden;' >
<table id=the10Table width='100%' cellspacing='1' border='0' cellpadding='0' style='background-color:#E4E5EE'>
<tr class='tableHead' style="top:expression(document.getElementById('the11Div').scrollTop)">
.......
<div id=the10Div style="height:400;overflow-x:hidden;overflow-y:auto;" onscroll= "the11Div.scrollTop=scrollTop " >
<table id=the10Table width='100%' cellspacing='1' border='0' cellpadding='0' style='background-color:#E4E5EE' >
......
</table></div></td><td>
<div id=the11Div style=' width:650;height:400;overflow-x:auto;overflow-y:hidden;' >
<table id=the10Table width='100%' cellspacing='1' border='0' cellpadding='0' style='background-color:#E4E5EE'>
<tr class='tableHead' style="top:expression(document.getElementById('the11Div').scrollTop)">
.......
http://topic.csdn.net/t/20051026/11/4351175.html关于类似EXCEL效果的可以参考:
http://community.csdn.net/Expert/topic/5345/5345647.xml?temp=.5694086
好像powertable可以实现
它的基本思路是把表折成六块:
00块是固定不动的,01块是第一行表头,02块无内容
10块是首N列,11块是主要内容区,12块是竖向滚动条
20块无内容,21块是横向滚动条,22块无内容。
这种固定首行首列的局限有:行高得一定,初始化有点慢...。
但是并不会造成在滚动或操作时太慢。
分析你所遇到的问题的原因,可能是你们已经在原有代码上进行了修改,
不明白为什么把“style="top:expression...”这段移到tr里去了,
会造成在tr很多时速度变慢。如果想用expression放到tr里的,可以参考JK的第二代固定表头首行首列,
虽说效率不好,两千行还是可以支持的
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>JK:支持民族工业,尽量少买X货</title>
<style>.fixedHeaderTr
{
z-index:10;
position:relative;
top:expression(this.offsetParent.scrollTop);
}; .relativeTag
{
position:relative;
};.fixedHeaderCol
{
background-color:#cccccc;
position:relative;
left:expression(this.parentElement.offsetParent.scrollLeft);
}; .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);
}
</style>
</head> <body>
<div style="font-size:10pt;">
注1:部分代码来自:http://blog.csdn.net/wu_yongcai/archive/2004/11/21/189816.aspx<br/>
注2:固定首行首列,不需破坏table的结构,在不需scroll时与页面无缝相处。<br/>
<br/>
注:本页面仅在IE6下测试过。其它浏览器或其它版本未经测试。<br/>
注-----:JK:<a href="mailTo:[email protected]?subject=About%20FixTableHeader">[email protected]</a><br/>
<hr/>
</div><br>
<div class="mainDiv" id=mailContainerDiv>
<table width="100%" cellspacing=0 border=1 style="margin-top:-2;margin-left:-1">
<TR class="fixedHeaderTr" style="background:navy;color:white;">
<TD nowrap class="fixedHeaderCol" style="background:navy;color:white;">Header A</TD>
<TD nowrap class="fixedHeaderCol" style="background:navy;color:white;">Header B</TD>
<TD nowrap>Header C</TD>
</TR>
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol" >B</TD>
<TD nowrap >
部分代码来自:<br>
http://blog.csdn.net/wu_yongcai/archive/2004/11/21/189816.aspx</TD>
</TR >
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol">B</TD>
<TD>C</TD>
</TR>
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol">B</TD>
<TD>C</TD>
</TR>
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol">B</TD>
<TD>C</TD>
</TR>
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol">B</TD>
<TD>C</TD>
</TR>
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol">B</TD>
<TD>C</TD>
</TR>
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol">B</TD>
<TD>C</TD>
</TR>
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol">B</TD>
<TD>C</TD>
</TR>
<TR class="relativeTag" >
<TD class="fixedHeaderCol" >A</TD>
<TD class="fixedHeaderCol">B</TD>
<TD>C</TD>
</TR>
</table>
</div>
</body>
</html>