onmouseover事件显示隐藏二维码

1.二维码鼠标滑过事件onmouseover,onmouseout
在这里插入图片描述

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        .nodeSmall{
            width: 50px;
            height:50px;
            background: url(3.jpg) no-repeat -159px -51px;
            position:fixed ;
            right:10px;
            top:40%;
        }
        .erweima{
            position: absolute;
            top:0;
            left: -250px;
        }
        .nodeSmall a{
            display: block;
            width: 350px;
            height: 50px;
        }
        .hide{
            display: none;
        }
        .show{
            display: block;
        }
    </style>
    <script>
        window.function () {
            var a=document.getElementsByTagName("a")[0];
            var div=document.getElementsByClassName("erweima")[0];
            a.function () {
               div.className="erweima show";
                //字符串操作
                /*div.className=div.className.replace("hide","show");*/
            }
            a.function () {
                div.className="erweima hide";
            }
        }
    </script>
</head>
<body>
        <div class="nodeSmall" id="node_small">
                <a href="#"></a>
                <div class="erweima hide " id="er">
                    <img src="3.jpg" style="height: 200px;width: 200px;" alt="">
                </div>
        </div>
</body>
</html>

猜你喜欢

转载自blog.csdn.net/zuo_zuo_blog/article/details/89060688