我有一个 HTML 表格,如下面的代码所示。这有 16 列。我正在使用 javascript 设置单元格宽度。当总宽度小于 100% 时,它工作正常。
当总宽度超过 100% 时,我想显示一个horizontal scroll bar. 但是当我将黄色突出显示的单元格的宽度从 5% 更改为 30% 时,所有剩余的单元格都被隐藏而不是滚动条的外观。
问题:
- 为什么滚动条目前没有出现?
 - 我们如何通过展示使其正常工作
scroll bar?(黄色列之后的两列也应该visible;不隐藏) 
注意:该问题在IE8中注明。
注意:有关代码,请参阅http://jsfiddle.net/Lijo/dYSfN/2/。这没有显示问题。为了可视化问题,请将代码复制到 html 文件中并使用 IE8 打开
更新
在hiding a columnFirefox 和 Chrome 中,剩余的列宽度会自动调整为表格宽度,但在 IE8 中则不会。在 IE8 中,表格宽度shrinks。
问题详情
黄色高亮单元格宽度为 5% 时

黄色高亮单元格宽度为 30% 时

风格
   .gridTableBorder
   {
        overflow:scroll;
        border: 2px solid green;
   }
    /*GridView Tables*/
    .resultGridTable
    {
        table-layout: fixed; /*Needed along with word wrap */
    }
    .resultGridTable th
    {
        background-color: #A7A7A6;
        color: #ffffff;
        padding: 2px 5px 2px 5px;
        font: bold 9pt Arial;
        border: 1px solid red;
        word-wrap: break-word;
    }
    .resultGridTable td
    {
        padding: 0px 5px 0px 5px;
        font: normal 9pt Arial;
        word-wrap: break-word;
        border: 1px solid blue;
    }
JAVASCRIPT
    $(document).ready(function () {
        //Width Setting
        var numberOfColumns = 16;
        $('.resultGridTable th, .resultGridTable td').each(function (i) {
            if (i % numberOfColumns == 0) {
                $(this).css('width', '1%');
            }
            if (i % numberOfColumns == 1) {
                $(this).css('width', '10%');
            }
            if (i % numberOfColumns == 2) {
                $(this).css('width', '9%');
            }
            if (i % numberOfColumns == 3) {
                $(this).css('width', '8%');
                $(this).css('background-color', 'orange');
            }
            if (i % numberOfColumns == 4) {
                $(this).css('width', '6%');
            }
            if (i % numberOfColumns == 5) {
                $(this).css('width', '8%');
            }
            if (i % numberOfColumns == 6) {
                $(this).css('width', '5%');
            }
            if (i % numberOfColumns == 7) {
                $(this).css('width', '5%');
            }
            if (i % numberOfColumns == 8) {
                $(this).css('width', '5%');
            }
            ///
            if (i % numberOfColumns == 9) {
                $(this).css('width', '7%');
            }
            if (i % numberOfColumns == 10) {
                $(this).css('width', '8%');
                $(this).css('background-color', 'orange');
            }
            if (i % numberOfColumns == 11) {
                $(this).css('width', '5%');
            }
            if (i % numberOfColumns == 12) {
                $(this).css('width', '5%');
            }
            if (i % numberOfColumns == 13) {
                $(this).css('width', '30%');
                $(this).css('background-color', 'Yellow');
            }
            if (i % numberOfColumns == 14) {
                $(this).css('width', '7%');
            }
            if (i % numberOfColumns == 15) {
                $(this).css('width', '7%');
            }
        }
        );
        //Hide Is Summary Row Column
        var selectedElements = $("tr").find("th:first, td:first");
        $(selectedElements).hide();
    }
    );
HTML
<body>
<form method="post" action="LocalTaxReport.aspx" id="form1">
<div id="wrapper">
    <div id="container">
        <div id="centralContainer">
            <div id="mainContainer">
                <div id="contentHolderDiv" class="contentHolderDiv">
                    <div id="resultContainer" class="resultContainerDiv">
                        <div id="gridDiv" class="gridTableBorder">
                            <div>
                                <table class="resultGridTable" cellspacing="0" id="detailContentPlaceholder_grdLocalTaxReport"
                                    style="border-collapse: collapse;">
                                    <tr>
                                        <th scope="col">
                                            IsSummaryRow
                                        </th>
                                        <th scope="col">
                                            Associate
                                        </th>
                                        <th scope="col">
                                            My Amount
                                        </th>
                                        <th scope="col">
                                            Federal Withholding
                                        </th>
                                        <th scope="col">
                                            Social Security
                                        </th>
                                        <th scope="col">
                                            Medicaring
                                        </th>
                                        <th scope="col">
                                            State Tax
                                        </th>
                                        <th scope="col">
                                            County Tax
                                        </th>
                                        <th scope="col">
                                            City Tax
                                        </th>
                                        <th scope="col">
                                            Total
                                        </th>
                                        <th scope="col">
                                            State
                                        </th>
                                        <th scope="col">
                                            State Code
                                        </th>
                                        <th scope="col">
                                            County
                                        </th>
                                        <th scope="col">
                                            County Code
                                        </th>
                                        <th scope="col">
                                            City
                                        </th>
                                        <th scope="col">
                                            City Code
                                        </th>
                                    </tr>
                                    <tr>
                                        <td>
                                            False
                                        </td>
                                        <td>
                                            Mary Dryden
                                        </td>
                                        <td>
                                            $3450
                                        </td>
                                        <td>
                                            $32
                                        </td>
                                        <td>
                                            $5
                                        </td>
                                        <td>
                                            $2
                                        </td>
                                        <td>
                                            $10
                                        </td>
                                        <td>
                                            $1
                                        </td>
                                        <td>
                                            $2
                                        </td>
                                        <td>
                                            $3400
                                        </td>
                                        <td>
                                            Arkansas
                                        </td>
                                        <td>
                                            AR
                                        </td>
                                        <td>
                                            Benton
                                        </td>
                                        <td>
                                            04567
                                        </td>
                                        <td>
                                            Bentonville
                                        </td>
                                        <td>
                                            23156
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </div>
                    </div>
                    <div class="clear">
                    </div>
                </div>
            </div>
            <div class="clear">
            </div>
        </div>
    </div>
</div>
</form>
 <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.1.js"></script>
</body>