You are here: colgroup + style + mouse over/out in table = sluggish response « HTML « IT news, forums, messages
colgroup + style + mouse over/out in table = sluggish response

Posted by relaxedrob on 04/24/06 11:37

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
:)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация