屏蔽这句话
//event.srcElement.setCapture();

解决方案 »

  1.   

    如果这样的话,可能是版本不一致的关系。我用的ie6我把我测试贴出来。
    <HTML><HEAD>
    <META http-equiv=Content-Type content="text/html; charset=gb2312">
    <SCRIPT>
    var ms=0;
    function did(obj){
    ms=obj;
    //alert(obj);
    //event.srcElement.setCapture();
    x=document.all(ms).style.pixelLeft-event.clientX;
    y=document.all(ms).style.pixelTop-event.clientY;
    }function document.onmousemove(){
    if(ms){
    document.all(ms).style.pixelLeft=x+event.clientX;
    document.all(ms).style.pixelTop=y+event.clientY;
       document.all.x1.value=x+event.x;
      document.all.y1.value=y+event.y;
    }
    }function document.onmouseup(){
    if(ms){
    event.srcElement.releaseCapture();
    ms=0;
    }
    }
    </SCRIPT><META content="MSHTML 6.00.2600.0" name=GENERATOR></HEAD>
    <BODY>
    <input id=x1 ><input id=y1 >
    <br/>
    <span  style="overflow: scroll;POSITION:
    absolute;border: 1px solid #000000;width:900px;height:800px"    >
    <DIV id=a1 style="POSITION:relative;top:100px;left:2px;border: 1px solid #ffaa12;WIDTH: 
    100px; HEIGHT: 50px; "><DIV onmousedown="did('a1')" id=a2 
    style="WIDTH: 100px; CURSOR: move; HEIGHT: 50px; BACKGROUND-COLOR: #f2f2f2">
    <table width="100%" style="font-size: 12.5px; text-align: center;">
       <tr>
         <td>
             部门编号
         </td>
         <td>
            <input id="DepID" type="text" size="8" runat="server" />
         </td>
        </tr>
        <tr>
         <td>
             部门名称
         </td>
         <td>
             <input id="DepName" type="text" size="8"  runat="server" />
         </td>
       </tr>
       <tr>
         <td colspan="2">
            <asp:Button ID="Save" runat="server" Text="确定" OnClick="Save_Click" />
         </td>
       </tr>
     </table>
    </DIV>
    </DIV>
    </span>
    </BODY></HTML>
    或者,在这个方法里加
    function document.onmouseup(){
    if(ms){
    event.srcElement.releaseCapture();
    event.srcElement.focus();
    ms=0;
    }