以下代码的目的是当用户按住SHIFT键时,某些文本将指示他们正在按下它.它在Firefox中运行良好,但IE不承认它.
window.onmousemove = function(e) { e = e || window.event; var copyLabel = document.getElementById("<%= lblCopyEnabled.ClientID %>"); if (e.shiftKey) { copyLabel.style.display = "inline"; ob_copyOnNodeDrop = true; } else { copyLabel.style.display = "none"; ob_copyOnNodeDrop = false; } }
建议表示赞赏.
解决方法
尽管MSDN文档说的是,onmousemove在应用于window对象时不起作用.如果将其应用于文档对象,它应该适用于所有浏览器:
document.onmousemove = function(e) { e = e || window.event; var copyLabel = document.getElementById("<%= lblCopyEnabled.ClientID %>"); if (e.shiftKey) { copyLabel.style.display = "inline"; ob_copyOnNodeDrop = true; } else { copyLabel.style.display = "none"; ob_copyOnNodeDrop = false; } }