javascript彈出浮動層,並鎖定頁面(1)

來源:互聯網
上載者:User

 <html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>提示資訊框</title>
    <style type="text/css">
    body
    {
        filter: progid:DXImageTransform.Microsoft.Gradient(gradientType=0,startColorStr=#ffffff,endColorStr=#ffffff);
    }
    #massage_box
    {
        position: absolute;
        left: expression((body.clientWidth-350)/2);
        top: expression((body.clientHeight-200)/2);
        width: 350px;
        height: 200px;
        filter: dropshadow(color=#666666,offx=3,offy=3,positive=2);
        z-index: 2;
        visibility: hidden;
    }
    #mask
    {
        position: absolute;
        top: 0;
        left: 0;
        width: expression(body.scrollWidth);
        height: expression(body.scrollHeight);
        background: #ffffff;
        filter: ALPHA(opacity=60);
        z-index: 1;
        visibility: hidden;
    }
    .massage
    {
        border: #036 solid;
        border-width: 1 1 3 1;
        width: 95%;
        height: 95%;
        background: #fff;
        color: #036;
        font-size: 12px;
        line-height: 150%;
    }
    .header
    {
        background: #036;
        height: 10%;
        font-family: Verdana, Arial, Helvetica, sans-serif;
        font-size: 12px;
        padding: 3 5 0 5;
        color: #fff;
    }
    </style>
    <!--實現層移動-->

    <script type="text/javascript">
    var Obj=''
    document.onmouseup=MUp
    document.onmousemove=MMove

    function MDown(Object)
    {
        Obj=Object.id
        document.all(Obj).setCapture()
        pX=event.x-document.all(Obj).style.pixelLeft;
        pY=event.y-document.all(Obj).style.pixelTop;
    }

    function MMove()
    {
        if(Obj!='')
        {
           document.all(Obj).style.left=event.x-pX;
           document.all(Obj).style.top=event.y-pY;
        }
    }

    function MUp()
    {
        if(Obj!='')
        {
           document.all(Obj).releaseCapture();
           Obj='';
        }
    }
    </script>

</head>
<body>
    <div id="massage_box">
        <div class="massage">
            <div class="header" onmousedown="MDown(massage_box)">
                <div style="display: inline; width: 150px; position: absolute">
                    本站提示資訊
                </div>
                <span onclick="massage_box.style.visibility='hidden'; mask.style.visibility='hidden'"
                    style="float: right; display: inline; cursor: hand">× </span>
            </div>
            <ul style="margin-right: 25">
                <li>你的要放的代碼 </li>
                <input type="text">
                <br>
                <input type="button" value="這是按扭">
                </li>
                <li></li>
                <li></li>
            </ul>
        </div>
    </div>
    <div id="mask">
    </div>
    <span onclick="mask.style.visibility='visible';massage_box.style.visibility='visible'" style="cursor: hand"><a href="#">顯示提示資訊 </a></span>
</body>
</html>

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.