table#headers {table-layout:fixed;background:#eea033;}
table#data {table-layout:relative;background:#eea033;}
td, th {vertical-align:top;background:#ffffff;}
var rh;
var fr;
var ds;
var hs;
function syncScroll(e) {
hs.scrollLeft = ds.scrollLeft;
}
function syncResize(e) {
hs.style.width = ds.offsetWidth-(ds.offsetWidth – ds.clientWidth);
for( i =0; i < rh.childNodes.length; i++ ) {
rh.childNodes[i].width = fr.childNodes[i].offsetWidth;
}
}
function init() {
rh = document.getElementById(“rh”);
fr = document.getElementById(“fr”);
ds = document.getElementById(“ds”);
hs = document.getElementById(“hs”);
hs.style.top = ds.offsetTop;
hs.style.left = ds.offsetLeft;
hs.style.visibility = ‘visible’;
ds.οnscrοll=syncScroll;
window.οnresize=syncResize;
syncResize();
}
col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | col9 | col10 |
---|
col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | col9 | col10 |
---|---|---|---|---|---|---|---|---|---|
this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | thisisawidthtest– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works |
this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works |
this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works |
col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | col9 | col10 |
---|
col1 | col2 | col3 | col4 | col5 | col6 | col7 | col8 | col9 | col10 |
---|---|---|---|---|---|---|---|---|---|
this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | thisisawidthtest– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works |
this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works |
this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works | this is a width test– please tell me it works |
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
Header A | Header B | Header C |
---|---|---|
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
Header A | Header B | Header C |
---|---|---|
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
A | B | C |
[Ctrl+A 全部选择 提示:你可先修改部分代码,再按运行]
欢迎大家阅读《通过技巧固定表格的标题列的代码_html》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码
搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:通过技巧固定表格的标题列的代码_html