在Internet Explorer 11

时间:2015-07-08 06:31:07

标签: javascript jquery html css internet-explorer

我在div标签中有两个列表。我想拖拽和在我的代码中删除类型功能。它正在与Chrome合作但在IE中无法使用

当在div上输入鼠标时,我正在录制其ID" Selected"或"删除" in" listSelected"变量和在MouseUp事件中我正在检查使用变量" listSelected"释放哪个div鼠标按钮。实现MouseDown事件以了解起始div标签&用户期待拖动操作。

但问题是在MouseDrag事件被触发后,MouseEnter事件未在IE中触发。它适用于Chrome。当我释放按钮时,MouseEnter或MouseOver事件在拖动时不会立即触发。

如果有人知道如何在IE中处理这个问题会有所帮助。这是我的代码

HTML

<div id="lstRmv" style="float: left; background-color:antiquewhite" onclick="return MouseClick();" onmousedown="return MouseDown(event,'Removed');" onmouseenter="return MouseEnter('Removed');" onmouseout="return MouseLeave(event, 'Removed');">
    <h5>Removed Transactions</h5>
    <asp:ListBox ID="lst_AllTrn" class="defaultcursor" runat="server" Rows="15" Width="225px" Height="200px" onclick="return MouseClick();" SelectionMode="Multiple"></asp:ListBox>
</div>
<div style="float: left;">
</div>
<div id="lstSel" style="float: left" class="drop"  onmousedown="return MouseDown(event,'Selected');" onmouseenter="return MouseEnter('Selected');" onmouseout="return MouseLeave(event, 'Selected');">
    <h5>Selected Transactions</h5>
    <asp:ListBox ID="lst_SelectedTrn" class="defaultcursor" runat="server" Rows="15" Width="225px" Height="200px" SelectionMode="Multiple"></asp:ListBox>
</div>

脚本

function MouseLeave(e, id) {
    if (listSelected == id)
            listSelected = "";
}

function MouseEnter(id) {
    listSelected = id;
}

function MouseDown(e, id) {
    listDrag = id;
        $('.defaultcursor').css('cursor', 'move');
        dragging = true;
}

function MouseUp(e) {
    if (dragging) {
            if (listDrag == 'Removed' && listSelected == "Selected")
                    alert("Transaction Selected");
                else if (listDrag == 'Selected' && listSelected == "Removed")
                    alert("Transaction Removed");
            }
            dragging = false;
            $('.defaultcursor').css('cursor', 'default');
}

0 个答案:

没有答案