In the previous article, we used jquery to implement full selection of checkboxes. We got suggestions from some friends. I was really not sure about the definition of the plug-in, which made me laugh. Some friends suggested that I read "Sharp Jquery". To be honest, I was watching it. Since I am still studying, I want to write the jquery effects that are often used in projects into general methods. I can improve these methods with everyone's help, and also let people who don't know how to do it learn about a method, and finally form my own Jquery method. Library to facilitate future use. These examples are all written by myself without reference, so there are many areas that need improvement.
1: Why write this method
In the project, some tables must be styled. In order to make the styles beautiful, the table header has one style, the odd-numbered rows have one style, and the even-numbered rows have one style. The color changes when the mouse passes over it, and returns to color when the mouse leaves. This is how you do it.
2: Implementation process
js file xs_table_css.js
Style file xs_table.css
.xs_table_odd
{
Height: 50px;
Background-color: #FFFFFF;
}
.xs_table_select
{
Height: 50px;
Background-color: #D9D9D9;
}
Page file xs_table_css.htm
headone | headTwo |
---|---|
第一行 | 111111111 |
第二行 | 222222222 |
第三行 | 333333333 |
第四行 | 444444444 |
headone | headTwo |
---|---|
第一行 | 111111111 |
第二行 | 222222222 |
第三行 | 333333333 |
第四行 | 444444444 |
3:方法说明
(1)mouseover和mouseout要先移除上次的css,不然会出现样式叠加
(2)找tr时注意tbody,虽然页面上没有tbody标签,但是默认会有这个子元素
(3)奇偶行要去除th,只找td的