div展现与收起效果(鼠标移入移出)

效果图:

移入:

移出:

 

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鼠标移入移出展现与收起效果</title>
    <style type="text/css">
        body{
            margin: 0 auto;
            padding: 0;
        }
        #pn{
            background: #e8e8e8;
            width: 600px;
            display: block;
            margin: 0 auto;
            padding: 5px;
            font-size: 9pt;
            height: auto;
        }
        .slide{
            margin: 0 auto;
            padding: 0;
            width: 600px;
            border-top: 4px solid gray;
        }
        .btn-slide{
            background: gray;
            width:120px;
            height: 30px;
            text-align: center;
            margin: 0 auto;
            display: block;
            color: #fff;
            text-decoration: none;
            padding-top: 10px;
        }
    </style>
    <script type="text/javascript">
    function showdiv(){
        document.getElementById("hpn").style.display="block";
        document.getElementById("strHref").innerHTML="收起-";

    }
    function hidediv(){
        document.getElementById("hpn").style.display="none";
        document.getElementById("strHref").innerHTML="更多选项+";

    }
    </script>
</head>
<body>
    <div class="slide">
        <a onmouseover="showdiv();" id="strHref" class="btn-slide">更多选项+</a>
        <div id="pn">
            <div id="hpn" onmouseout="hidediv()" style="display:none">
                <p>价格:5000以上 4000-4999 3000-3999</p>
                <p>特点:JDPhone计划‘0’元购机 放水</p>
            </div>
        </div>
    </div>


</body>
</html>

 

posted @ 2016-04-11 23:27  嘆世殘者——華帥  阅读(680)  评论(0编辑  收藏  举报