One, interlaced color change
$ ("tr:odd"). CSS ("Background-color", "#eeeeee"), $ ("Tr:even"). CSS ("Background-color", "#ffffff");
or a line to fix:
$ ("Table tr:nth-child (Odd)"). CSS ("Background-color", "#eeeeee");
: Nth-child matches nth child or odd-even element under its parent element
second, the mouse after discoloration
$ ("tr"). Live ({mouseover:function () {$ (this). CSS ("Background-color", "#eeeeee");},mouseout:function () {$ (this). css ("Background-color", "#ffffff");})
or
$ ("tr"). Bind ("MouseOver", function () {$ (this). CSS ("Background-color", "#eeeeee");}) $ ("tr"). Bind ("Mouseout", function () {$ (this). CSS ("Background-color", "#ffffff");})
of course, both live () and bind () can bind multiple events or separate at the same time.
If the table table is dynamically added see: http://blog.csdn.net/itmyhome1990/article/details/30245973