Click here to Skip to main content
15,897,371 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello There,

Below is my code. How can i freeze my table colums?


HTML
<pre lang="HTML"><table id="tblExtraHoursWorked" style="display: inline;" width="100%" border="1px"
        cellspacing="0">
        <thead style="removed:fixed; background-color: Green; color: White;">
            <tr>
                <td style="width: 15%; font-weight: bold; color: White; text-align: center">
                    Employee Code
                </td>
                <td style="width: 25%; font-weight: bold; color: White; text-align: center">
                    Name of the Employee
                </td>
                <td style="width: 25%; font-weight: bold; color: White" colspan="8">
                    <table class="gridColorHeader" width="100%" border="1px" cellspacing="0">
                        <tbody>
                            <tr>
                                <td colspan="8" align="center">
                                    Last 2 Days ( Shift Wise )
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4" align="center">
                                    23-10-2014
                                </td>
                                <td colspan="4" align="center">
                                    24-10-2014
                                </td>
                            </tr>
                            <tr>
                                <td style="width: 25px; text-align: center">
                                    G
                                </td>
                                <td style="width: 25px; text-align: center">
                                    A
                                </td>
                                <td style="width: 25px; text-align: center">
                                    B
                                </td>
                                <td style="width: 25px; text-align: center">
                                    C
                                </td>
                                <td style="width: 25px; text-align: center">
                                    G
                                </td>
                                <td style="width: 25px; text-align: center">
                                    A
                                </td>
                                <td style="width: 25px; text-align: center">
                                    B
                                </td>
                                <td style="width: 25px; text-align: center">
                                    C
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
                <td style="width: 35%; font-weight: bold; color: White" colspan="12">
                    <table class="gridColorHeader" width="100%" border="1px" cellspacing="0">
                        <tbody>
                            <tr>
                                <td colspan="12" align="center">
                                    Last 3 Days ( Shift Wise )
                                </td>
                            </tr>
                            <tr>
                                <td colspan="4" align="center">
                                    25-10-2014
                                </td>
                                <td colspan="4" align="center">
                                    26-10-2014
                                </td>
                                <td colspan="4" align="center">
                                    27-10-2014
                                </td>
                            </tr>
                            <tr>
                                <td align="center">
                                    G
                                </td>
                                <td align="center">
                                    A
                                </td>
                                <td align="center">
                                    B
                                </td>
                                <td align="center">
                                    C
                                </td>
                                <td align="center">
                                    G
                                </td>
                                <td align="center">
                                    A
                                </td>
                                <td align="center">
                                    B
                                </td>
                                <td align="center">
                                    C
                                </td>
                                <td align="center">
                                    G
                                </td>
                                <td align="center">
                                    A
                                </td>
                                <td align="center">
                                    B
                                </td>
                                <td align="center">
                                    C
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </td>
            </tr>
        </thead>
        <tbody style="padding-removed1000px">
            <tr style="background-color: white">
                <td>
                    <span id="emp_code0" style="font-weight: normal">ONM_000671</span>
                </td>
                <td>
                    Anil Kumar
                </td>
                <td style="width: 25px; text-align: center">
                    0
                </td>
                <td style="width: 25px; text-align: center">
                    0
                </td>
                <td style="width: 25px; text-align: center">
                    0
                </td>
                <td style="width: 25px; text-align: center">
                    0
                </td>
                <td style="width: 25px; text-align: center">
                    0
                </td>
                <td style="width: 25px; text-align: center">
                    0
                </td>
                <td style="width: 25px; text-align: center">
                    0
                </td>
                <td style="width: 25px; text-align: center">
                    0
                </td>
                <td>
                    <input id="txtgen_Three0" class="EHW" readonly="readonly" placeholder="G" style="width: 25px;
                        border-color: brown; color: brown; text-align: center" maxlength="2" value="0"
                        type="text">
                </td>
                <td>
                    <input id="txtfirst_Three0" class="EHW" readonly="readonly" placeholder="A" style="width: 25px;
                        border-color: green; color: green; text-align: center" maxlength="2" value="0"
                        type="text">
                </td>
                <td>
                    <input id="txtsecond_Three0" class="EHW" readonly="readonly" placeholder="B" style="width: 25px;
                        border-color: orange; color: orange; text-align: center" maxlength="2" value="0"
                        type="text">
                </td>
                <td>
                    <input id="txtthrid_Three0" class="EHW" readonly="readonly" placeholder="C" style="width: 25px;
                        border-color: black; color: black; text-align: center" maxlength="2" value="0"
                        type="text">
                </td>
                <td>
                    <input id="txtgen_Four0" class="EHW" readonly="readonly" placeholder="G" style="width: 25px;
                        border-color: brown; color: brown; text-align: center" maxlength="2" value="0"
                        type="text">
                </td>
                <td>
                    <input id="txtfirst_Four0" class="EHW" readonly="readonly" placeholder="A" style="width: 25px;
                        border-color: green; color: green; text-align: center" maxlength="2" value="0"
                        type="text">
                </td>
                <td>
                    <input id="txtsecond_Four0" class="EHW" readonly="readonly" placeholder="B" style="width: 25px;
                        border-color: orange; color: orange; text-align: center" maxlength="2" value="0"
                        type="text">
                </td>
                <td>
                    <input id="txtthrid_Four0" class="EHW" readonly="readonly" placeholder="C" style="width: 25px;
                        border-color: black; color: black; text-align: center" maxlength="2" value="0"
                        type="text">
                </td>
                <td>
                    <input id="txtgen_Five0" class="EHW" placeholder="G" style="width: 25px; border-color: brown;
                        color: brown; text-align: center" maxlength="2" value="0" type="text">
                </td>
                <td>
                    <input id="txtfirst_Five0" class="EHW" placeholder="A" style="width: 25px; border-color: green;
                        color: green; text-align: center" maxlength="2" value="0" type="text">
                </td>
                <td>
                    <input id="txtsecond_Five0" placeholder="B" style="width: 25px; border-color: orange;
                        color: orange; text-align: center" class="EHW" maxlength="2" value="0" type="text">
                </td>
                <td>
                    <input id="txtthrid_Five0" class="EHW" placeholder="C" style="width: 25px; border-color: black;
                        color: black; text-align: center" maxlength="2" value="0" type="text">
                </td>
            </tr>
               
        </tbody>
    </table>



Regards,
K N R
Posted
Updated 28-Oct-14 0:59am
v2

1 solution

Unfortunately I have no the source of it, but only the link to JSFiddle...http://jsfiddle.net/emn13/YMvk9/[^]...

Of course it does not work in old (before 9) IE!
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900