案例:百度换肤
案例:表格隔行换色
</tbody>
</table>
<script>
// 1.获取元素 获取的是tbody里面所有的行
var trs = document.querySelector('tbody').querySelectorAll('tr');
// 2.利用循环绑定注册事件
for (var i = 0; i < trs.length; i++) {
// 3.鼠标经过事件onmouseover
trs[i].onmouseover = function() {
this.className = 'bg';
}
// 4.鼠标离开事件onmouseout
trs[i].onmouseout = function() {
this.className = ''
}
}
</script>
代码 | 名称 | 最新公布净值 | 累计净值 | 前单位净值 | 净值增长率 |
---|---|---|---|---|---|
003526 | 农行 | 1.075 | 1.079 | 1.074 | +0..047% |
003526 | 农行 | 1.075 | 1.079 | 1.074 | +0..047% |
003526 | 农行 | 1.075 | 1.079 | 1.074 | +0..047% |
003526 | 农行 | 1.075 | 1.079 | 1.074 | +0..047% |
003526 | 农行 | 1.075 | 1.079 | 1.074 | +0..047% |
案例:表单全选和取消全选
案例:tab栏切换案例