• 通过样式表实现固定表头和列


    <html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
        <title>固定表头和列</title>
        <style>
            .FixedTitleRow
            {
                position: relative;
                top: expression(this.offsetParent.scrollTop);
                z-index: 10;
                background-color: #E6ECF0;
            }
           
            .FixedTitleColumn
            {
                position: relative;
                left: expression(this.parentElement.offsetParent.scrollLeft);
            }
           
            .FixedDataColumn
            {
                position: relative;
                left: expression(this.parentElement.offsetParent.parentElement.scrollLeft);
                background-color: #E6ECF0;
            }
        </style>
    </head>
    <body>
       <div id="scrollDiv" style=" 300px; overflow: auto; cursor: default; display: inline;
            position: absolute; height: 200px;">
            <table id='accountTable' width='500' height='230' cellpadding='0' cellspacing='0'
                style='table-layout: auto' bordercolor='lightgrey'>
                <tbody>
                    <tr class="FixedTitleRow">
                        <td class="FixedTitleColumn">
                            ID0</td>
                        <td class="FixedTitleColumn">
                            CK0</td>
                        <td class="FixedTitleColumn">
                            Code0</td>
                        <td class="FixedTitleColumn">
                            Descirption0</td>
                        <td class="FixedTitleColumn">
                            TOL0</td>
                        <td>
                            XS0</td>
                        <td >
                            SS0</td>
                        <td>
                            MS0</td>
                        <td>
                            DS0</td>
                        <td>
                            BS0</td>
                        <td>
                            XL0</td>
                        <td>
                            ML0</td>
                        <td>
                            DL0</td>
                        <td>
                            EM0</td>
                        <td>
                            BM0</td>
                    </tr>
                    <tr>
                        <td class="FixedDataColumn">
                            88</td>
                        <td class="FixedDataColumn">
                            88</td>
                        <td class="FixedDataColumn">
                            88</td>
                        <td class="FixedDataColumn">
                            88</td>
                        <td class="FixedDataColumn">
                            88</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                        <td>
                            22</td>
                    </tr>
                    <tr>
                        <td class="FixedDataColumn">
                            111</td>
                        <td class="FixedDataColumn">
                            111</td>
                        <td class="FixedDataColumn">
                            1111</td>
                        <td class="FixedDataColumn">
                            This is Test</td>
                        <td class="FixedDataColumn">
                            1</td>
                        <td>
                            001</td>
                        <td>
                            002</td>
                        <td>
                            003</td>
                        <td>
                            004</td>
                        <td>
                            005</td>
                        <td>
                            006</td>
                        <td>
                            007</td>
                        <td>
                            008</td>
                        <td>
                            009</td>
                        <td>
                            010</td>
                    </tr>
                    <tr>
                        <td class="FixedDataColumn">
                            111</td>
                        <td class="FixedDataColumn">
                            111</td>
                        <td class="FixedDataColumn">
                            1111</td>
                        <td class="FixedDataColumn">
                            This is Test</td>
                        <td class="FixedDataColumn">
                            1</td>
                        <td>
                            001</td>
                        <td>
                            002</td>
                        <td>
                            003</td>
                        <td>
                            004</td>
                        <td>
                            005</td>
                        <td>
                            006</td>
                        <td>
                            007</td>
                        <td>
                            008</td>
                        <td>
                            009</td>
                        <td>
                            010</td>
                    </tr>
                    <tr>
                        <td class="FixedDataColumn">
                            111</td>
                        <td class="FixedDataColumn">
                            111</td>
                        <td class="FixedDataColumn">
                            1111</td>
                        <td class="FixedDataColumn">
                            This is Test</td>
                        <td class="FixedDataColumn">
                            1</td>
                        <td>
                            001</td>
                        <td>
                            002</td>
                        <td>
                            003</td>
                        <td>
                            004</td>
                        <td>
                            005</td>
                        <td>
                            006</td>
                        <td>
                            007</td>
                        <td>
                            008</td>
                        <td>
                            009</td>
                        <td>
                            010</td>
                    </tr>
                </tbody>
            </table>
        </div>

    </body>
    </html>

  • 相关阅读:
    《面试题 03.05. 栈排序》——惰性更新
    CTF<密码学> writeup 传统知识+古典密码
    有趣的数学(二)
    【】Dedecms友情链接去掉LI的方法介绍
    【】【】打工子弟学校学生们的中国梦何时圆?
    Discuz! 7.2 防注册机注册+发垃圾帖的解决方法
    Windows 8 常用快捷键
    Win7 64位系统下Auto CAD 2010注册激活,出现警告:Make sure you can write to current directory...
    怎么从EXCEL或WORD里提取图片?
    如何将windows xp系统下的outlook express6.0的邮件,帐号及通迅录导入Office Outlook xp/2003/2007中...
  • 原文地址:https://www.cnblogs.com/harbin1900/p/8480993.html
Copyright © 2020-2023  润新知