Just a quickie. Got it working fine with one table using an ID. But how do I affect different tables with class="striped"?
Example here:
Zebra Stripes on ALA - classes?
First, let me state I don't know javascript worth a darn.
The method they have presented will stripe a single table. To do multiple tables you would have to expand the function to include the ability to iterate through multiple ids specified in the onload= event. One of the frustrations of working with javascript and CSS is that although there is a document.getElementById(id) function there is no comparable document.getElementByClass(class).
DE
Zebra Stripes on ALA - classes?
Damn it, I was afraid of that.
Ah well, I guess I'll figure it out with many IDs.
Just one thing though - in the JS the two colors are specified; yet in the body tag, two different colors are specified. What is the reasoning? And which one affects the trs?
Zebra Stripes on ALA - classes?
Well, your last question is easy - the colors in the JS are defaults in case the striping function was called with only the id name and neither of the color parameters - the color parameters are passed to variables with the two statments:
var evenColor = arguments[1] ? arguments[1] : "#fff";
var oddColor = arguments[2] ? arguments[2] : "#eee";
if the argument[1] exists - it becomes the evenColor and so on. Without the parameters the colors would be defaulted to that in the JS. (at least I know THAT much - LOL)
I'm wondering if it is possible to make two or more calls to the function with:
<body onload="stripe('id1', '#fff', '#edf3fe');stripe('id2', '#fff', '#edf3fe');stripe('id3', '#fff', '#edf3fe');">
DE
Zebra Stripes on ALA - classes?
I'll have a look - cheers mate.