JavaScript
  Home arrow JavaScript arrow An Improved Approach to Building Zebra Tab...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
JAVASCRIPT

An Improved Approach to Building Zebra Tables
By: Alejandro Gervasio
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2008-06-25

    Table of Contents:
  • An Improved Approach to Building Zebra Tables
  • Constructing zebra tables dynamically
  • Working with tables that contain multiple tbody sections
  • Setting up a final hands-on example

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    An Improved Approach to Building Zebra Tables


    (Page 1 of 4 )

    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.

    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!

    More JavaScript Articles
    More By Alejandro Gervasio


       · This third tutorial of the series will show you how to improve the signature of the...
       · Nice article.If the page contains two tables it is applying for both table...
       · Thank you for the kind comments on my article. With reference to your question, it’s...
     

    JAVASCRIPT ARTICLES

    - Validating Digits and Dates with jQuery`s Va...
    - Validating Ranges, Emails, and URLs with jQu...
    - More Uses for the jQuery Tooltip Plug-in`s b...
    - Building Image-Based Tooltips with the jQuer...
    - Using the jQuery Tooltip Plug-in`s bodyHandl...
    - Using Rangelength, Min and Max with the Vali...
    - Using Minlength and Maxlength with the Valid...
    - Modifying Tooltip Coordinates with the jQuer...
    - Applying a Fade Out Effect with the jQuery T...
    - Tracking Mouse Movements with the jQuery Too...
    - Checking Online Forms with the Validator jQu...
    - Nested JavaScript Functions as Objects
    - The jQuery Tooltip Plug-in
    - Active Client Pages at the Server
    - ACP Tab Web Page







    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    Stay green...Green IT