Jquery代码:
1 $( " table tr:nth-child(even) " ).addClass( " striped " ); 2 3 $( " tr " ).mouseover( function () { 4 $( this ).addClass( " over " ); 5 }).mouseout( function () { 6 $( this ).removeClass( " over " ); 7 })
这里有一个JQuery的链式操作
1 | $( "tr" ).mouseover(funtion(){ |
2 | $( this ).addClass( "over" );}) |
3 | $( "tr" ).mouseout(funtion(){ |
4 | $( this ).removeClass( "over" );}) |