如何防止在Firefox中拖动鼠标时选择文本? [英] how to prevent text selection when dragging mouse in Firefox?
本文介绍了如何防止在Firefox中拖动鼠标时选择文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道这些拖放部件如何取消拖动元素和页面中其他元素的文本选择。我尝试了以下在IE8中工作的代码(无法选择文本),但是在Firefox中仍然无法工作(仍然可以选择文本)。
I am wondering how those drag and drop widgets cancel text selection in the dragging element and other elements in the page. I tried the following code which works in IE8 (cannot select text) but does not work (can still select text) in Firefox.
<!DOCTYPE html>
<html>
<body>
<p>Hello World</p>
<script type="text/javascript">
document.onmousemove = function() {
return false;
}
</script>
</body>
</html>
推荐答案
/ p>
Or, analagous to your IE8 solution for Moz:
document.body.style.MozUserSelect="none"
这篇关于如何防止在Firefox中拖动鼠标时选择文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文