The arc90 lab is the playground of arc90 - a New York-based technology and strategic consulting firm. The lab is a place for us to share our ideas, tools and the occasional experiment in web technology. All ideas, experiments and tools are licensed under Creative Commons.
This site is licensed under a Creative Commons Attribution 2.5 License.
Tools
Alternating Rows
Make your tabular data nice and readable with tool number five from the arc90 lab, Alternating Rows. Just add some colors to our JavaScript and -- voila! -- no hassle alternate row coloring.
What is this?
Ever walk by a coworker's desk and catch him tracing across his screen with his index finger? Sick of staring at reports where the rows all blend together? Tabular data should have properly placed emphasis - without having to corrupt data with display information.
With just a single line of code, Alternating Rows styles up any table with easy to read row coloring that you define. Your data stays pristene, your output is improved and your markup barely changes. It's a win-win-win.
How Do I Use It?
To use Alternating Rows on your site or blog, just follow these simple steps:
Download The Code
Click on the icon below to download the source code:
The file, altrows.zip, contains the script and an example page. Once downloaded, upload the script to relevant location on your hosted site.
Link To The Javascript
Add a link to the javascript file in the page(s) you'd like alternating rows implemented. Remember to adjust the path to properly point to the location of the javascript file:
Styling your tabular data
There are two ways to style your alternating rows:
You can define colors right in the table's class tag by choosing your desired row colors, defined in hexadecimal and separated by a dash, and adding them as the class="arc90_altrows-[your codes here]" attribute of your table. Here's an example: