javascript - 在 Firefox 中拖动鼠标时如何防止文本选择?

标签 javascript firefox

我想知道那些拖放小部件如何取消页面中拖动元素和其他元素中的文本选择。我尝试了以下代码,它在 IE8 中有效(无法选择文本)但在 Firefox 中无效(仍然可以选择文本)。

<!DOCTYPE html>
<html>
<body>
  <p>Hello World</p>
  <script type="text/javascript">
    document.onmousemove = function() {
      return false;
  }
  </script>
</body>
</html>

最佳答案

或者,类似于您的 Moz IE8 解决方案:

document.body.style.MozUserSelect="none"

关于javascript - 在 Firefox 中拖动鼠标时如何防止文本选择?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2931620/

相关文章:

javascript - 将用于检测特定类链接点击的 jQuery 代码转换为原生 JavaScript

javascript - 用负数格式化货币

http - Firefox 获取 API : How to omit the "origin" header in the request?

firefox - 同一台电脑上的多个 Firefox 版本

javascript - 使用格式化数据渲染,使用 DataTables.net 中的原始数据排序

javascript - Javascript中有没有类似Python的numpy.apply_along_axis的东西?

javascript - 来自 "How FIleReader.readAsText in HTML5 File API works"的文件读取器错误

jquery - Firefox 中未发送 Ajax 请求,错误未知

javascript - firebug (1.10.1) 表明 javascript 不限于 firefox (13.0) 中的单个线程

css - Firefox:下拉列表中的 float 元素显示错误