-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path焦点变色.html
More file actions
40 lines (36 loc) · 731 Bytes
/
焦点变色.html
File metadata and controls
40 lines (36 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
li {
display: block;
cursor: pointer;
}
</style>
</head>
<body>
<ul>
<li>李四</li>
<li>李四</li>
<li>李四</li>
<li>李四</li>
<li>李四</li>
<li>李四</li>
<li>李四</li>
<li>李四</li>
</ul>
<script>
var list = document.getElementsByTagName("li");
for (var i = 0; i < list.length; i++){
list[i].onmousemove = function () {
this.style.backgroundColor = "red";
};
list[i].onmouseout = function () {
this.style.backgroundColor = "#ffffff";
};
}
</script>
</body>
</html>