![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
I am trying to merge to scripting samples I for on a source code web site and having limited luck. Then first one is called Zebra Tables witch colors alternate rows of a table to look beter. The second is a rule code that highlights the row you are currently moused over. Both are making use of CSS style sheet to do all of their formating. My problem is that the rollover is changing the text color but not the color of the row background as the example does in the original code which is what I am looking for out of this. Anyone have any ideas??? Link to the Samples are here: http://www.alistapart.com/articles/zebratables/ http://www.alistapart.com/articles/tableruler/ |
#2
| |||
| |||
|
#3
| |||||
| |||||
|
|
Michael Winter wrote: URL:http://www.mlwinter.pwp.blueyonder.c...der/table.html A very clear and enjoyable script. |
|
FWIW, here are some suggestions/questions: |

|
- in the CSS declarations, I don't think that you need to use "table td"-like selectors, "td" only would do; AFAICS you're trying to address invalid-HTML cases, where we'd have TD elements anywhere - but then you're telling the OP to fix invalid HTML. Fixing HTML should be enough:-) |
|
- "if( b = tB[ i ]) {" is a bit strange, since you're iterating in the tBodies collection, the tBody has to exist; have you come across any implementation in which this wasn't the case? |
|
- "r[ j ].onmouseover = function() {" is declaring a different function at each iteration; you could declare the function once and then use reference. Moreover, on a technical note, functions expressions declared this way could hardly be joined because of scope issues, so if you still want to declare functions in a loop I'd advise using the Function Constructor instead, in which case it's easier for implementations to create joined objects (although not compulsory - a single function, then references remains the best method). |
![]() |
| Thread Tools | |
| Display Modes | |
| |