Thanks.  I tried that but it did not work.  Tried placing it within
the function, outside the function, etc.  I think the issue has
something to do with the dynamic creation of the table.  I've done
this in the past with Spry which has operators that enable you to do
this. I haven't been able to find similar features in jQuery.

On Jan 27, 7:13 pm, donb <falconwatc...@comcast.net> wrote:
> $("tr:odd","table.stripeme").addClass('altcolor');
>
> is a way to stripe the rows.  It is assumed there is a class
> 'altcolor' with a suitable background-color definition.
>
> On Jan 27, 4:43 pm, septemberbrain <kindlerda...@gmail.com> wrote:
>
> > I have some code that reads an xml file and outputs to a table.  I
> > would like the rows to have alternate colors but cannot get it to work
> > properly.  Below is my code.  Hope someone can help.
>
> > Thanks!
> >   <script src="../jQuery/jquery-1.3.1.min.js" type="text/javascript"></
> > script>
>
> > <style type="text/css">
> >         tr.alt td {background:#e1e7e8;}
> >         tr.over td {background::#99a4a4;}
>
> > </style>
> >      <script type="application/javascript">
> >          $(document).ready(function(){
> >              $.ajax({
> >                  type: "GET",
> >                  url: "FTF_OLL.xml",
> >                  dataType: "xml",
> >                  success: function(xml) {
> >                      $(xml).find('Document').each(function(){
> >                          var title_text = $(this).find('Title').text()
> >                          var type_text = $(this).find('Type').text()
> >                          var format_text = $(this).find('Format').text
> > ()
> >                          var location_text = $(this).find
> > ('Location').text()
> >                          var track_text = $(this).find('Track').text()
> >                          var company_text = $(this).find
> > ('Company').text()
>
> >                          $('<tr></tr>')
> >                              .html('<td>' + title_text + '</td><td>' +
> > type_text + '</td><td>' + format_text + '</td><td>' + location_text +
> > '</td><td>' + track_text + '</td><td>' + company_text + '</td>' )
> >                              .appendTo('#update-target table');
> >                      }); //close each(
> >                  }
> >              }); //close $.ajax(
> >  }); //close $(
> >      </script>
> >    </head>
> >    <body>
> >      <p>
> >        <div id='update-target'>
> >          <table class="stripeMe"><tr><td>Title</td><td>Type</
> > td><td>Format</td><td>Location</td><td>Track</td><td>Company</td></
> > tr></table>         </div>
> >      </p>

Reply via email to