鼠標移入圖片位置時張開嘴巴:
<!DOCTYPE html> | |
<html> | |
<head> | |
<metacharset="UTF-8"> | |
<title></title> | |
<script> | |
function closeEye(){ | |
var eye = document.getElementById("eye"); | |
eye.src = "img/77.png"; | |
} | |
function openEye(){ | |
var eye = document.getElementById("eye"); | |
eye.src = "img/88.png"; | |
} | |
</script> | |
</head> | |
<body> | |
<divonmouseover="closeEye()"onmouseout="openEye()"style="width: 200px;"> | |
<imgid="eye"src="img/77.png" /> | |
</div> | |
</body> | |
</html> | |
鼠標移入圖片時閉眼:
<!DOCTYPE html> | |
<html> | |
<head> | |
<metacharset="UTF-8"> | |
<title></title> | |
<script> | |
function closeEye(){ | |
var eye = document.getElementById("eye"); | |
eye.src = "img/66.png"; | |
} | |
function openEye(){ | |
var eye = document.getElementById("eye"); | |
eye.src = "img/55.png"; | |
} | |
</script> | |
</head> | |
<body> | |
<divonmouseover="closeEye()"onmouseout="openEye()"style="width: 200px;"> | |
<imgid="eye"src="img/55.png" /> | |
</div> | |
</body> | |
</html> | |