zoukankan      html  css  js  c++  java
  • 层代码 可以拖动 可以关闭

    <style type="text/css">
    #netmoer {background-color:#000000;height:700px;1000px;position:absolute;left:0px;top:0px;}
    #netmoera{border: 1px solid #666666;margin-top:1px;background-color: #FFFFFF;position: absolute;
    height: 600px; 800px;float: left;}
    .netmoeratitle{padding:0px 10px 0px 10px;border-bottom:1px solid #EEEEEE;        line-height: 30px;height: 30px;color: #000000;font-weight: bold;font-size: 16px;cursor: move;}
    .netmoerainfo{height: 100%; 100%;margin-top: 0px;padding: 10px;}
    .netshubiao{cursor:pointer;text-decoration: underline;}
    </style>
    </head>
    <body>
    <div id="bodyL">
    <a class="netshubiao" onclick = "show('netmoer');return false;">
    [网站公告]</a>
    <a href="#" class="od" onclick = "closeed('netmoer');return false;">
    </a>
    </div>

    <!--服务开始 -->
    <div id="netmoer" style="display:none;filter:alpha(opacity=90); -moz-opacity:0.90;opacity:0.90;">
    <div id="netmoera" class="netmorebox" style="left:10%;top:10%;">
    <div class="netmoeratitle"><span style="float:left">点击可拖动</span><span style="float:right; margin-top:5px;"><input onclick = "closeed('netmoer');return false;" type="button" value="关闭" /></span>
    </div>
    <div class="netmoerainfo">
    <iframe marginwidth="0" marginheight="0" height="100%" width="100%" scrolling="no" align="center" border="0" frameborder="0" src="http://www.sjg8.com/shop/">
    </iframe>
    </div>
    </div>
    </div>
    <!--服务结务-->
    <script type="text/javascript">
    var prox;
    var proy;
    var proxc;
    var proyc;
    function show(id){/*--打开--*/
    clearInterval(prox);
    clearInterval(proy);
    clearInterval(proxc);
    clearInterval(proyc);
    var o = document.getElementById(id);
    o.style.display = "block";
    o.style.width = "100%";
    o.style.height = "100%";
    prox = setInterval(function(){openx(o,1000)},10);
    }
    function openx(o,x){/*--打开x--*/
    var cx = parseInt(o.style.width);
    if(cx < x)
    {
    o.style.width = (cx + Math.ceil((x-cx)/5)) +"px";
    }
    else
    {
    clearInterval(prox);
    proy = setInterval(function(){openy(o,700)},10);
    }
    }
    function openy(o,y){/*--打开y--*/
    var cy = parseInt(o.style.height);
    if(cy < y)
    {
    o.style.height = (cy + Math.ceil((y-cy)/5)) +"px";
    }
    else
    {
    clearInterval(proy);
    }
    }
    function closeed(id){/*--关闭--*/
    clearInterval(prox);
    clearInterval(proy);
    clearInterval(proxc);
    clearInterval(proyc);
    var o = document.getElementById(id);
    if(o.style.display == "block")
    {
    proyc = setInterval(function(){closey(o)},10);
    }
    }
    function closey(o){/*--打开y--*/
    var cy = parseInt(o.style.height);
    if(cy > 0)
    {
    o.style.height = (cy - Math.ceil(cy/5)) +"px";
    }
    else
    {
    clearInterval(proyc);
    proxc = setInterval(function(){closex(o)},10);
    }
    }
    function closex(o){/*--打开x--*/
    var cx = parseInt(o.style.width);
    if(cx > 0)
    {
    o.style.width = (cx - Math.ceil(cx/5)) +"px";
    }
    else
    {
    clearInterval(proxc);
    o.style.display = "none";
    }
    }


    /*===========鼠标拖动========*/
    var ie=document.all;
    var nn6=document.getElementById&&!document.all;
    var isdrag=false;
    var y,x;
    var oDragObj;

    function moveMouse(e) {
    if (isdrag) {
    oDragObj.style.top = (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y)+"px";
    oDragObj.style.left = (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x)+"px";
    return false;
    }
    }

    function initDrag(e) {
    var oDragHandle = nn6 ? e.target : event.srcElement;
    var topElement = "HTML";
    while (oDragHandle.tagName != topElement && oDragHandle.className != "netmorebox") {
    oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement;
    }
    if (oDragHandle.className=="netmorebox") {
    isdrag = true;
    oDragObj = oDragHandle;
    nTY = parseInt(oDragObj.style.top+0);
    y = nn6 ? e.clientY : event.clientY;
    nTX = parseInt(oDragObj.style.left+0);
    x = nn6 ? e.clientX : event.clientX;
    document.onmousemove=moveMouse;
    return false;
    }
    }
    document.onmousedown=initDrag;
    document.onmouseup=new Function("isdrag=false");
    </script>

  • 相关阅读:
    1055. [HAOI2008]玩具取名【区间DP】
    BZOJ2435:[NOI2011]道路修建 (差分)
    1084. [SCOI2005]最大子矩阵【网格DP】
    1060. [ZJOI2007]时态同步【树形DP】
    1050. [HAOI2006]旅行【并查集+枚举】
    2463. [中山市选2009]谁能赢呢?【博弈论】
    luogu P1195 口袋的天空
    luogu P1162 填涂颜色
    luogu P1223 排队接水
    luogu P1331 海战
  • 原文地址:https://www.cnblogs.com/buffer/p/1711320.html
Copyright © 2011-2022 走看看