<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 = "1px";
        o.style.height = "1px";
        prox = setInterval(function() { openx(o, 700) }, 1);
    }
    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, 200) }, 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 od = document.getElementById("fd");
    var dx, dy, mx, my, mouseD;
    var odrag;
    var isIE = document.all ? true : false;
    document.onmousemove = function(e) {
        var e = e ? e : event;
        if (e.button == (document.all ? 1 : 0)) {
            mouseD = true;
        }
    }
    document.onmouseup = function() {
        mouseD = false;
        odrag = "";
        if (isIE) {
            od.releaseCapture();
            od.filters.alpha.opacity = 100;
        }
        else {
            window.releaseEvents(od.MOUSEMOVE);
            od.style.opacity = 1;
        }
    }
    //function readyMove(e){
    od.onmousedown = function(e) {
        odrag = this;
        var e = e ? e : event;
        if (e.button == (document.all ? 1 : 0)) {
            mx = e.clientX;
            my = e.clientY;
            od.style.left = od.offsetLeft + "px";
            od.style.top = od.offsetTop + "px";
            if (isIE) {
                od.setCapture();
                od.filters.alpha.opacity = 50;
            }
            else {
                window.captureEvents(Event.MOUSEMOVE);
                od.style.opacity = 0.5;
            }//            alert(mx);
//            alert(my);        }
    }
    document.onmousemove = function(e) {
        var e = e ? e : event;        //alert(mrx);
        //alert(e.button);
   
        if (mouseD == true && odrag) {
            var mrx = e.clientX - mx;
            var mry = e.clientY - my;
            od.style.left = parseInt(od.style.left) + mrx + "px";
            od.style.top = parseInt(od.style.top) + mry + "px";
            mx = e.clientX;
            my = e.clientY;        }
        //alert(mx);
        //alert(my);
    }

</script>
如上,这是一个实现弹出层的代码,但是层里面的控件不能输入,点击没有反应了,去掉: 
document.onmousemove = function(e) {
        var e = e ? e : event;
        if (e.button == (document.all ? 1 : 0)) {
            mouseD = true;
        }
    }
以后层里面的控件可以输入,但是层不能用鼠标拖着移动了。那位帮忙改一下,既可以移动层,又可以让层里面的控件可用。感激不尽 。

解决方案 »

  1.   

        <div id="fd" style="display: none; filter: alpha(opacity=100); opacity: 1;">
                                <div class="content" runat="server">
                                    <%--<asp:Panel ID="pnlItemAdd" runat="server" Style="z-index: 1000; left: 150px; width: 700px;
                            position: absolute; top: 130px; height: 200px; background-image: url('../../Contents/Image/BackGround/bg.jpg');"
                            Visible="false" BorderStyle="Outset">--%>
                                    <!-- Header -->
                                    <table width="100%" style="position: absolute; top: 0px; left: 0px" cellspacing="0"
                                        cellpadding="0" border="0">
                                        <tr valign="top" style="width: 100%">
                                            <td>
                                                <table style="width: 100%" border="0" cellspacing="0">
                                                    <tr>
                                                        <td align="right" valign="bottom" width="10px">
                                                            &nbsp;&nbsp;
                                                        </td>
                                                        <td align="left" valign="bottom" height="30px" width="200px">
                                                            <img src="../../Contents/Image/BackGround/spacer.gif" width="3px" alt="" />
                                                            <asp:Label ID="flblTITLE4" runat="server" Style="height: 23px;" CssClass="SrchLabel"
                                                                Width="200px">消費品目追加</asp:Label>
                                                        </td>
                                                        <td align="right" valign="bottom" width="0px">
                                                        </td>
                                                        <td align="left" valign="bottom" width="100px">
                                                        </td>
                                                        <td rowspan="2" style="width: 240px; background-image: url(../../Contents/Image/BackGround/top-srch-c.gif);
                                                            background-repeat: no-repeat; background-position: bottom left;">
                                                            <table width="100%" border="0" cellpadding="0" cellspacing="0">
                                                                <tr>
                                                                    <td style="width: 50px">
                                                                        &nbsp;
                                                                    </td>
                                                                    <td style="width: 85px;" valign="baseline">
                                                                        <asp:ImageButton ID="imgADD" ImageUrl="../../Contents/Image/BackGround/btn-add1-1.jpg"
                                                                            ImageAlign="Middle" runat="server" BorderWidth="0px" BorderStyle="None" TabIndex="-1"
                                                                            OnClick="imgADD_Click"></asp:ImageButton>
                                                                    </td>
                                                                    <td style="width: 85px;" valign="baseline">
                                                                        <%--<asp:ImageButton ID="imgBackI"  class="od" ImageUrl="../../Contents/Image/BackGround/btn-back1-1.jpg"
                                                                            ImageAlign="Middle" runat="server" BorderWidth="0px" BorderStyle="None" TabIndex="-1"
                                                                            <%--OnClick="imgBackI_Click"></asp:ImageButton>--%>
                                                                        <asp:ImageButton ID="imgBackI" class="od" ImageUrl="../../Contents/Image/BackGround/btn-back1-1.jpg"
                                                                            ImageAlign="Middle" runat="server" BorderWidth="0px" BorderStyle="None" TabIndex="-1"
                                                                            OnClientClick="closeed('fd');return false;"></asp:ImageButton>
                                                                    </td>
                                                                    <td>
                                                                        &nbsp;
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4" style="background-color: #E70000; height: 8px;">
                                                            <img src="../../Contents/Image/BackGround/spacer.gif" height="8px" alt="" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                    <asp:Panel ID="panel3" Style="z-index: 103; left: 20px; position: absolute; top: 50px;
                                        width: 666px; height: 110px;" runat="server">
                                        <asp:Label ID="flblITEM_NO2" Style="left: 8px; position: absolute; top: 10px" runat="server"
                                            Width="80px" CssClass="fi_mtitle">品目コード</asp:Label>
                                        <%--<asp:TextBox ID="txtITEM_NO2" Style="left: 90px; position: absolute; top: 10px; width: 150px;
                                    height: 17px;" runat="server" MaxLength="20" CssClass="text_input_left_key" TabIndex="1"></asp:TextBox>--%>
                                        <asp:TextBox ID="txtITEM_NO2" Style="left: 90px; position: absolute; top: 10px; width: 150px;
                                            height: 17px;" runat="server" MaxLength="20" CssClass="text_input_left_key" TabIndex="1"></asp:TextBox>
                                        <img id="imgItem" style="z-index: 107; position: absolute; top: 10px; left: 249px;"
                                            src="../../Contents/Image/BackGround/sbtn_srch.gif" runat="server" alt="" />
                                        <asp:TextBox ID="lblITEM_DESC2" runat="server" Style="left: 285px; position: absolute;
                                            top: 10px; width: 315px; height: 17px;" BackColor="#CCCCCC" CssClass="d_label"
                                            ReadOnly="true" TabIndex="-1" BorderWidth="1px"></asp:TextBox>
                                        <asp:Label ID="flblINPUT_QTY" runat="server" CssClass="fi_mtitle" Style="left: 8px;
                                            position: absolute; top: 35px" Width="80px">投入数</asp:Label>
                                        <cc1:NumberBox ID="txtINPUT_QTY" runat="server" Style="left: 90px; position: absolute;
                                            top: 35px; width: 100px; height: 17px; text-align: right" CssClass="text_input_right_key"
                                            DecimalPlaces="2" MaxLength="12" TabIndex="2"></cc1:NumberBox>
                                    </asp:Panel>
                                    <%--</asp:Panel>--%>
                                </div>
                            </div>
      

  2.   

    td>
                    <%--<asp:Button ID="btnLineAdd" runat="server" Text="行追加" Style="top: -35px; left: 60px;
                        position: absolute;" Width="80px" OnClick="btnLineAdd_Click" />--%>
                    <input type="button" class="od" value="行追加" style="top: -35px; left: 60px; position: absolute;"
                        width="80px" onclick="show('fd')">
                    <%-- <div id="bodyL">
                        <a href="#" class="od" onclick="show('fd');return false;">行追加</a>
                         <a href="#" class="od" onclick="closeed('fd');return false;">[???] </a>
                    </div>--%>
                    <%--<input type="button" class="od" value="行削除" Text="行削除" Style="top: -35px; left: 170px;
                        position: absolute;" Width="80px" onclick="closeed('fd')">--%>
                    <asp:Button ID="btnLineDelete" runat="server" Text="行削除" Style="top: -35px; left: 170px;
                        position: absolute;" Width="80px" OnClick="btnLineDelete_Click" />
                </td>