colgroup + style + mouse over/out in table = sluggish response

Discussion in 'HTML' started by relaxedrob@optusnet.com.au, Apr 24, 2006.

  1. Guest

    Hi All,

    I have a page that displays a table with rows whose color changes when
    you roll over them. Here is the style and script tags from the table:

    <style type="text/css">
    .highlight {
    background: #eeeeee;
    }
    .unhighlight {
    background: white;
    }
    .spacer {
    width: 0.5%;
    }
    .hyphen {
    text-align: left;
    width: 2%;
    }
    </style>


    <SCRIPT type="text/javascript">

    function mouseOutRow(row) {
    document.body.style.cursor = 'default';
    if (row.bgColor != "#dddddd") {
    row.className = "unhighlight";
    }
    }

    function mouseOverRow(row) {
    document.body.style.cursor = 'hand';
    if (row.bgColor != "#dddddd") {
    row.className = "highlight";
    }
    }
    </SCRIPT>

    And here is a cut down version of the <table> tag:

    <table width="100%" cellpadding="0" cellspacing="0">
    <colgroup><col></col><col></col><col></col><col></col><col></col></colgroup>
    <tbody style="font-size: 10px;font-family: sans-serif;">
    <tr style="display:table-row;" onMouseOver="mouseOverRow(this);"
    onMouseOut="mouseOutRow(this);"><td>col one</td><td>col two</td></tr>
    </tbody></table>

    Make about 300 of those table rows (I have different content in them of
    course: this is just an example) and the resulting page is quite slow:
    the mouse over/out actions is very sluggish.

    I have worked out that if I remove the style in the tbody OR the
    colgroup tags, it is much faster.. but I need to style the text and I
    need the colgroup tags because on some versions of the page I hide
    columns.

    Any ideas on how I can have both my styling and colgroups with ok
    performance?

    All thoughts welcome!

    Rob
    :)
     
    , Apr 24, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Meade

    <asp:table> and <colgroup> ?

    Rob Meade, Apr 19, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    4,180
    Eliyahu Goldin
    Apr 19, 2005
  2. PJ6
    Replies:
    2
    Views:
    756
  3. cpt
    Replies:
    4
    Views:
    2,595
    Toby Inkster
    Jan 11, 2005
  4. Jonathan N. Little
    Replies:
    3
    Views:
    480
    Toby A Inkster
    Mar 4, 2007
  5. TS
    Replies:
    5
    Views:
    3,769
    Steven Cheng[MSFT]
    Aug 16, 2007
Loading...

Share This Page