Helping ordinary people create extraordinary websites!

Striped Tables Using JavaScript

By Paul McCarthy
2008-01-23

Introduction

JavaScript can be incredibly useful when you need to automate repetitive tasks. In this article we'll implement a simple JavaScript function that will apply alternate striped rows to a table.

We'll implement this technique using unobtrusive JavaScript.

Resources for the striped tables tutorial

Download the required resources before beginning this tutorial.

Start by opening the file 'striped-tables-example.htm'. This is the table we're going to add stripes to using JavaScript:


Rather than applying a class to every other row to assign the alternate background rows, we can let JavaScript do the work for us.



Tutorial pages:
 2 Votes

You might also want to check these out:


Leave a Comment on "Striped Tables Using JavaScript"
You must be logged in to post a comment.

Link to This Tutorial Page!


GET OUR NEWSLETTERS