Home arrow JavaScript arrow An Improved Approach to Building Zebra Tables

An Improved Approach to Building Zebra Tables

Welcome to the educational series that shows how to build zebra tables with CSS and JavaScript. In this third tutorial of the series Iím going to show you how to improve the signature of the JavaScript function defined in the last article. This will make it suitable for working with tables that include different <tbody> sections.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 2
June 25, 2008
  1. · An Improved Approach to Building Zebra Tables
  2. · Constructing zebra tables dynamically
  3. · Working with tables that contain multiple tbody sections
  4. · Setting up a final hands-on example

print this article

An Improved Approach to Building Zebra Tables
(Page 1 of 4 )

Over the years, zebra tables have become one of the preferred elements of many web designers, especially when it comes to displaying tabular data in a clear and professional fashion. This trend seems to be growing steadily over time. However, the most exciting aspect of these fancy tables is that they can be built using different approaches, including both client and server-side scripting.

However, when a zebra table is constructed manually by utilizing a few CSS styles to alternate the background colors of its respective odd and even rows, not only can this process be quite annoying, but it may lead to errors in the tableís (X)HTML markup, especially if the table in question is comprised of numerous rows.

In this particular case, JavaScript can be used to automate the styling process on the table. But as you may guess, learning the details of how to implement this approach requires some time and practice as well. Nonetheless, if you start reading this article series, youíll be provided with numerous hands-on examples concerning the creation of zebra tables by utilizing clean and unobtrusive JavaScript code. You can use them to improve the visual presentation of your own web siteís tabular data.

Having introduced the primary objective of this group of articles, let me review a couple of topics that were covered in the preceding tutorial. As youíll surely recall, in the last installment I explained how to automate the styling process for the even and odd rows of a selected table in order to provide it with the so-called ďzebraĒ appearance.

Naturally, this procedure was performed by way of a short JavaScript function that was tasked with alternately assigning two different CSS classes to the respective tableís rows. This implemented a simple, yet powerful, client-side approach that is handy for dynamically building different zebra tables. Now, does this technique ring any bells? I bet it does!

At this point, Iím reasonably sure that youíve already recalled the key concepts that surround the creation of zebra tables with CSS and JavaScript. Thus, itís the appropriate time to move forward and continue digging deeper into this interesting subject.

Letís continue this educational journey now!

blog comments powered by Disqus

- Project Nashorn to Make Java, JavaScript Wor...
- JavaScript Virus Attacks Tumblr Blogs
- Google Releases Stable Dart Version, JavaScr...
- Khan Academy Unveils New JavaScript Learning...
- Accessing Nitro? There`s an App for That
- JQuery 2.0 Leaving Older IE Versions Behind
- Fastest JavaScript Engine Might Surprise You
- Microsoft Adjusting Chakra for IE 10
- Brendan Eich: We Don`t Need Google Native Cl...
- An Overview of JavaScript Statements
- An Overview of JavaScript Operators
- Overview of JavaScript Variables
- More of the Top jQuery Social Plugins
- The Top jQuery Social Plugins
- More of the Top jQuery Slider Plugins

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 

Developer Shed Affiliates


© 2003-2019 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials