鼠标事件

鼠标悬停更换图片—睁眼闭眼

鼠标事件_第1张图片

鼠标事件_第2张图片


<html>
    <head>
        <meta charset="UTF-8">
        <title>title>
        <script>

            //睁眼
            function openEye(){
                var eye = document.getElementById("eye");
                eye.src = "img/eye01.jpg";
            }

            //闭眼
            function closeEye(){
                var eye = document.getElementById("eye");
                eye.src = "img/eye02.jpg";
            }

        script>
    head>
    <body>

        <div onmouseover="closeEye()" onmouseout="openEye()" style="float: left;border: 1px solid #000000;">
            <img id="eye" src="img/eye01.jpg" width="200px" />
        div>

    body>
html>

你可能感兴趣的:(鼠标事件)