iloveflag-blog

javascript实现图片变换

字数统计: 107阅读时长: 1 min
2018/06/27 Share
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>

<img src="hack.jpg" id="image">
<script>
var test=document.getElementById("image");
function change1(){
test.src="1.jpg";
}
function change2(){
test.src="2.jpg";
}
test.onmouseover=change1;
test.onmouseout=change2;

</script>

</body>
</html>
CATALOG