js-----实现鼠标移入灯点亮,移出灯变暗

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>#[{作业----鼠标移入灯点亮}]#</title>
    <script>
        function buloff() {
            document.getElementById('img').src='img/eg_bulboff.gif'
        }
        function bulon() {
            document.getElementById('img').src="img/eg_bulbon.gif"
        }
    </script>
</head>
<body>
<div align="center">
    <img id="img" src="img/eg_bulboff.gif" onmouseover="bulon()" onmouseout="buloff()">
</div>

</body>
</html>

猜你喜欢

转载自blog.csdn.net/xijiao_jiao/article/details/80918019