Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何链接表头的h-scroll与表体的h-scroll,而不链接表体的v-scroll与表头?_Javascript_Html_Css_Html Table - Fatal编程技术网

Javascript 如何链接表头的h-scroll与表体的h-scroll,而不链接表体的v-scroll与表头?

Javascript 如何链接表头的h-scroll与表体的h-scroll,而不链接表体的v-scroll与表头?,javascript,html,css,html-table,Javascript,Html,Css,Html Table,基本上,我想要的是一个固定的标题、冻结的窗格、表,例如。然而,他的表格有一个关键弱点。标题不会与正文一起水平滚动 这是一个基于上面链接的示例。但是,标题显然不会随表格正文左右滚动 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"

基本上,我想要的是一个固定的标题、冻结的窗格、表,例如。然而,他的表格有一个关键弱点。标题不会与正文一起水平滚动

这是一个基于上面链接的示例。但是,标题显然不会随表格正文左右滚动


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
    <head>
        <style type="text/css">
            .outer
            {
                position:relative;
                padding-top: 50px;
                border: 1px solid #0000ff;
            }
            .innera
            {
                overflow:auto;
                height: 100px;
                border: 1px solid #00ff00;
            }
            .outer thead tr
            {
                position:absolute;
                top: 0px;
                left:0;
            }
            .outer th, .outer td
            {
                text-align:left;
                white-space:nowrap;
            }
        </style>
    </head>
    <body>
        <div class="outer">
            <div class="innera">
                <table >
                    <thead>
                        <tr>
                            <th scope="col">FLIGHT CODE</th>
                            <th scope="col">FROM</th>
                            <th scope="col">STA</th>
                            <th scope="col">ETA</th>
                            <th scope="col" class="nd">Notes</th>
                        </tr>
                    </thead>

                    <tfoot>
                        <tr>
                            <td colspan="5">DATE : 19th OCTOBER 2005</td>
                        </tr>
                    </tfoot>

                    <tbody>
                        <tr>
                            <th scope="row">T3 4264</th>
                            <td>ISLE OF MAN</td>
                            <td>11:40</td>
                            <td>11:42</td>
                            <td>LANDED AT 11:43</td>
                        </tr>

                        <tr class="dk">
                            <th scope="row">BA 4081</th>
                            <td>PARIS-CDG</td>
                            <td>11:45</td>
                            <td>11:57</td>
                            <td>LANDED AT 11:58</td>
                        </tr>
                        <tr>
                            <th scope="row">BE 843</th>
                            <td>BELFAST CITY</td>
                            <td>11:45</td>
                            <td>11:40</td>
                            <td>LANDED AT 11:41</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">GR 642</th>
                            <td>GUERNSEY</td>
                            <td>11:55</td>
                            <td>11:38</td>
                            <td>LANDED AT 11:37</td>
                        </tr>
                        <tr>
                            <th scope="row">EZY 6192</th>
                            <td>PISA</td>
                            <td>12:05</td>
                            <td>12:18</td>
                            <td>LANDED AT 12:17</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 6052</th>
                            <td>MALAGA</td>
                            <td>12:15</td>
                            <td>11:55</td>
                            <td>LANDED AT 11:55</td>
                        </tr>
                        <tr>
                            <th scope="row">EZY 6074</th>
                            <td>ALICANTE</td>
                            <td>12:35</td>
                            <td>12:12</td>
                            <td>LANDED AT 12:14</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 6068</th>
                            <td>VALENCIA</td>
                            <td>12:40</td>
                            <td>12:49</td>
                            <td>LANDED AT 12:48</td>
                        </tr>
                        <tr>
                            <th scope="row">BA 4023</th>
                            <td>GLASGOW</td>
                            <td>12:50</td>
                            <td>12:41</td>
                            <td>LANDED AT 14:08</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">FR 506</th>
                            <td>DUBLIN</td>
                            <td>13:00</td>
                            <td>12:52</td>
                            <td>LANDED AT 12:51</td>
                        </tr>
                        <tr>
                            <th scope="row">EZY 6046</th>
                            <td>PALMA</td>
                            <td>13:20</td>
                            <td>16:31</td>
                            <td>LANDED AT 16:31</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EI 286</th>
                            <td>DUBLIN</td>
                            <td>13:40</td>
                            <td>13:33</td>
                            <td>LANDED AT 13:32</td>
                        </tr>
                        <tr>
                            <th scope="row">EZY 6096</th>
                            <td>BUDAPEST</td>
                            <td>13:40</td>
                            <td>13:38</td>
                            <td>LANDED AT 13:40</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">BE 152</th>
                            <td>JERSEY</td>
                            <td>13:50</td>
                            <td>13:36</td>
                            <td>LANDED AT 13:38</td>
                        </tr>
                        <tr>
                            <th scope="row">BA 4122</th>
                            <td>ZURICH</td>
                            <td>13:55</td>
                            <td>13:31</td>
                            <td>LANDED AT 13:31</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">T3 4505</th>
                            <td>ABERDEEN</td>
                            <td>14:10</td>
                            <td>14:19</td>
                            <td>LANDED AT 14:18</td>
                        </tr>
                        <tr>
                            <th scope="row">WOW 304</th>
                            <td>JERSEY</td>
                            <td>14:10</td>
                            <td>13:47</td>
                            <td>LANDED AT 13:48</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 4565</th>
                            <td>BERLIN-SCHOF</td>
                            <td>14:50</td>
                            <td>14:54</td>
                            <td>LANDED AT 14:55</td>
                        </tr>
                        <tr>
                            <th scope="row">BA 4085</th>
                            <td>PARIS-CDG</td>
                            <td>14:55</td>
                            <td>14:42</td>
                            <td>LANDED AT 14:43</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 6116</th>
                            <td>NICE</td>
                            <td>15:15</td>
                            <td>18:22</td>
                            <td>LANDED AT 18:21</td>
                        </tr>
                        <tr>
                            <th scope="row">KL 1053</th>
                            <td>AMSTERDAM</td>
                            <td>15:15</td>
                            <td>14:57</td>
                            <td>LANDED AT 14:57</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">BA 4039</th>
                            <td>EDINBURGH</td>
                            <td>15:25</td>
                            <td>15:28</td>
                            <td>LANDED AT 15:29</td>
                        </tr>
                        <tr>
                            <th scope="row">EZY 6026</th>
                            <td>BARCELONA</td>
                            <td>15:30</td>
                            <td>15:57</td>
                            <td>LANDED AT 15:58</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">MYT 792</th>
                            <td>RHODES</td>
                            <td>15:35</td>
                            <td>15:13</td>
                            <td>LANDED AT 15:14</td>
                        </tr>
                        <tr>
                            <th scope="row">SN 2055</th>
                            <td>BRUSSELS </td>
                            <td>15:55</td>
                            <td>15:35</td>
                            <td>LANDED AT 15:36</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 396</th>
                            <td>INVERNESS</td>
                            <td>15:55</td>
                            <td>15:56</td>
                            <td>LANDED AT 15:56</td>
                        </tr>
                        <tr>
                            <th scope="row">BE 1546</th>
                            <td>TOULOUSE</td>
                            <td>15:55</td>
                            <td>15:26</td>
                            <td>LANDED AT 15:26</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">BA 4028</th>
                            <td>MUNICH</td>
                            <td>16:00</td>
                            <td>15:47</td>
                            <td>LANDED AT 15:47</td>
                        </tr>
                        <tr>
                            <th scope="row">BE 1562</th>
                            <td>BORDEAUX</td>
                            <td>16:05</td>
                            <td>16:10</td>
                            <td>LANDED AT 16:10</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 6162</th>
                            <td>AMSTERDAM</td>
                            <td>16:05</td>
                            <td>16:07</td>
                            <td>LANDED AT 16:07</td>
                        </tr>
                        <tr>
                            <th scope="row">FCA 7301</th>
                            <td>F'VENTURA</td>
                            <td>16:05</td>
                            <td>15:38</td>
                            <td>LANDED AT 15:39</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">KL 1055</th>
                            <td>AMSTERDAM</td>
                            <td>16:20</td>
                            <td>16:14</td>
                            <td>LANDED AT 16:13</td>
                        </tr>
                        <tr>
                            <th scope="row">BA 4027</th>
                            <td>GLASGOW</td>
                            <td>16:40</td>
                            <td>16:28</td>
                            <td>LANDED AT 16:29</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">WOW 486</th>
                            <td>DUBLIN</td>
                            <td>16:50</td>
                            <td>16:48</td>
                            <td>LANDED AT 16:45</td>
                        </tr>
                        <tr>
                            <th scope="row">WOW 305</th>
                            <td>MANCHESTER</td>
                            <td>17:00</td>
                            <td>16:50</td>
                            <td>LANDED AT 16:49</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 569</th>
                            <td>NEWCASTLE werwerw erwerwerwerwerw werw erwer</td>
                            <td>17:15</td>
                            <td>17:02</td>
                            <td>LANDED AT 17:04</td>
                        </tr>
                        <tr>
                            <th scope="row">BE 1596</th>
                            <td>BERGERAC</td>
                            <td>17:15</td>
                            <td>17:00</td>
                            <td>LANDED AT 17:00</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 6156</th>
                            <td>GENEVA</td>
                            <td>17:20</td>
                            <td>17:05</td>
                            <td>LANDED AT 17:07</td>
                        </tr>
                        <tr>
                            <th scope="row">BA 4035</th>
                            <td>EDINBURGH</td>
                            <td>17:4065 dytud yude tyu dtyuety utyurt y uryu </td>
                            <td>19:54</td>
                            <td>LANDED AT 19:53</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">XLA 6225</th>
                            <td>RHODES</td>
                            <td>18:10</td>
                            <td>17:53</td>
                            <td>LANDED AT 17:54 drtdf hdhd dfhd fjfg jdfjdfg jdf j</td>
                        </tr>
                        <tr>
                            <th scope="row">EZY 406</th>
                            <td>GLASGOW</td>
                            <td>18:15</td>
                            <td>19:41</td>
                            <td>LANDED AT 19:41</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">FCA 7303</th>
                            <td>LARNACA</td>
                            <td>18:30</td>
                            <td>18:47</td>
                            <td>LANDED AT 18:47</td>
                        </tr>
                        <tr>
                            <th scope="row">T3 4507</th>
                            <td>ABERDEEN</td>
                            <td>18:35</td>
                            <td>18:50</td>
                            <td>LANDED AT 18:50</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">FR 508</th>
                            <td>DUBLIN</td>
                            <td>18:40</td>
                            <td>19:22</td>
                            <td>LANDED AT 19:19</td>
                        </tr>
                        <tr>
                            <th scope="row">BA 7644</th>
                            <td>MILAN</td>
                            <td>18:45</td>
                            <td>18:53</td>
                            <td>LANDED AT 18:53</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 6174</th>
                            <td>VENICE</td>
                            <td>18:50</td>
                            <td>19:34</td>
                            <td>LANDED AT 19:33</td>
                        </tr>
                        <tr>
                            <th scope="row">EZY 426</th>
                            <td>EDINBURGH</td>
                            <td>19:05</td>
                            <td>19:58</td>
                            <td>LANDED AT 19:59</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">BY 514</th>
                            <td>PAPHOS</td>
                            <td>19:10</td>
                            <td>18:45</td>
                            <td>LANDED AT 18:43</td>
                        </tr>
                        <tr>
                            <th scope="row">EZY 6128</th>
                            <td>PRAGUE</td>
                            <td>19:10</td>
                            <td>19:16</td>
                            <td>LANDED AT 19:15</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">BA 4089</th>
                            <td>PARIS-CDG</td>
                            <td>19:15</td>
                            <td>19:38</td>
                            <td>LANDED AT 19:38</td>
                        </tr>
                        <tr>
                            <th scope="row">BA 4102</th>
                            <td>FRANKFURT</td>
                            <td>19:50</td>
                            <td>19:36</td>
                            <td>LANDED AT 19:36</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">BA 4029</th>
                            <td>GLASGOW</td>
                            <td>19:55</td>
                            <td>19:49</td>
                            <td>LANDED AT 19:48</td>
                        </tr>
                        <tr>
                            <th scope="row">WOW 307</th>
                            <td>MANCHESTER</td>
                            <td>19:55</td>
                            <td>19:56</td>
                            <td>LANDED AT 19:56</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">WOW 487</th>
                            <td>LEEDS/BRAD</td>
                            <td>20:00</td>
                            <td>19:51</td>
                            <td>LANDED AT 19:51</td>
                        </tr>
                        <tr>
                            <th scope="row">KL 1057</th>
                            <td>AMSTERDAM</td>
                            <td>20:30</td>
                            <td>20:21</td>
                            <td>LANDED AT 20:21</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 573</th>
                            <td>NEWCASTLE</td>
                            <td>20:35</td>
                            <td>20:22</td>
                            <td>LANDED AT 20:24</td>
                        </tr>
                        <tr>
                            <th scope="row">BA 4087</th>
                            <td>PARIS-CDG</td>
                            <td>20:35</td>
                            <td>20:51</td>
                            <td>LANDED AT 20:50</td>
                        </tr>
                        <tr class="dk">
                            <th scope="row">EZY 450</th>
                            <td>BELFAST INTL</td>
                            <td>21:00</td>
                            <td>20:58</td>
                            <td>LANDED AT 20:59</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </div>


    </body>
</html>

外面的
{
位置:相对位置;
填充顶部:50px;
边框:1px实心#0000ff;
}
英内拉先生
{
溢出:自动;
高度:100px;
边框:1px实心#00ff00;
}
.外西亚德
{
位置:绝对位置;
顶部:0px;
左:0;
}
.外th,.外td
{
文本对齐:左对齐;
空白:nowrap;
}
航班代码
从…起
STA
希腊字母表的第7个字母
笔记
日期:2005年10月19日
T34264
马恩岛
11:40
11:42
11点43分降落
BA 4081
巴黎-CDG
11:45
11:57
11点58分降落
是843
贝尔法斯特市
11:45
11:40
11点41分降落
GR 642
根西岛
11:55
11:38
11点37分降落
EZY 6192
比萨
12:05
12:18
12点17分降落
EZY 6052
马拉加
12:15
11:55
11点55分降落
EZY 6074
阿利坎特
12:35
12:12
12点14分降落
EZY 6068
巴伦西亚
12:40
12:49
12点48分降落
BA 4023
格拉斯哥
12:50
12:41
14点08分降落
FR 506
都柏林
13:00
12:52
12点51分降落
EZY 6046
帕尔马
13:20
16:31
16点31分降落
EI 286
都柏林
13:40
13:33
13点32分降落
EZY 6096
布达佩斯
13:40
13:38
13点40分降落
152岁
运动衫
13:50
13:36
13点38分降落
BA 4122
苏黎世
13:55
13:31
13点31分降落
T34505
香港仔
14:10
14:19
14点18分降落
哇304
运动衫
14:10
13:47
13点48分降落
EZY 4565
柏林学校
14:50
14:54
14点55分降落
BA 4085
巴黎-CDG
14:55
14:42
14点43分降落
.innera
        {
            overflow:scroll; /*changed from auto to scroll*/
            height: 100px;
            border: 1px solid #00ff00;
        }