JS拖动层(方法一)

JS拖动层

 邬畏畏

<script language="JavaScript" type="text/javascript">

    var drag_ = false;

    var temp2, temp1,x,y;

    function divdown(obj) {

        temp1 = obj.offsetLeft; temp2 = obj.offsetTop;

        x = window.event.clientX;

        y = window.event.clientY;

        drag_ = true;

    }

    function divmove(obj) {

        if (drag_) {

            obj.style.left = temp1 + window.event.clientX - x + "px";

            obj.style.top = temp2 + window.event.clientY - y + "px";

        }

    }

    function divup() {

        drag_ = false;

    }

</script>

    <div id="edit" class="Edit">

<div id="edit_bar" style="background-color:#bbbbbb;height:25px;text-align:right"

onmousedown="divdown(edit)" onmousemove="divmove(edit)" onmouseup="divup()">

<span onclick="隐藏层的脚本"><img src='img/closeIcon.gif' /></span>

</div>

        <span align="center" style="font-size:12px;color:Blue">编辑名称</span><br>

        <input id="txtedit" type="text" value="" name="txtedit" style="width:120px" onmouseover="notmove()"/>

        <input type="button" value="修改保存" onclick="asyncSend(1)"/><input type="button" value="取消" onclick='HideLayer("edit")'/>

        <input id="Hidden_Table" type="hidden" runat="server" value="" /><!--"Trans_Area|T_Name|Tran_ID|recordID"--> 

    </div>

 

截图:

 

posted @ 2011-07-12 18:00  翱翔软件  阅读(572)  评论(0编辑  收藏  举报

欢迎访问翱翔软件