Style your HTML tables

I use the following CSS on my TR of TBODY in a table to help user to identify rows under inspection. On mouse over the row turns to light green and on double click it holds an orange color helpful for comparing rows.

I hate to add any intrusive JavaScript libraries and keep my table very simple.

onmouseover=”if(this.style.backgroundColor!=’orange’){this.style.backgroundColor=’lightGreen’;}” onmouseout=”if(this.style.backgroundColor==’lightgreen’){this.style.backgroundColor=”;}” ondblclick=”if(this.style.backgroundColor==’lightgreen’){this.style.backgroundColor=’orange’;}else if(this.style.backgroundColor==’orange’){this.style.backgroundColor=”;}”

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s