新的一天
This commit is contained in:
@@ -259,7 +259,15 @@
|
||||
|
||||
<script>
|
||||
//通过JS为上述的表格中数据行添加事件监听, 实现鼠标进入后, 背景色#f2e2e2; 鼠标离开后, 背景色需要设置为#fff; (JS新版本的语法)
|
||||
|
||||
let trs = document.querySelectorAll('tbody tr');
|
||||
trs.forEach(tr => {
|
||||
tr.addEventListener('mouseenter', () => {
|
||||
tr.style.backgroundColor = '#f2e2e2';
|
||||
})
|
||||
tr.addEventListener('mouseleave', () => {
|
||||
tr.style.backgroundColor = '#fff';
|
||||
})
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user