禁止拖放对象文本被选择
生活随笔
收集整理的這篇文章主要介紹了
禁止拖放对象文本被选择
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
禁止拖放對象文本被選擇的方法:?
1.ie中設置拖放對象的onselectstart返回false,在ff中設置樣式MozUserSelect(css:-moz-user-select)為none。?
這種方法只能禁止拖放對象本身被選擇。?
2.?
ie:document.selection.empty()?
ff:window.getSelection().removeAllRanges()?
兼容的寫法:?
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();?
1.ie中設置拖放對象的onselectstart返回false,在ff中設置樣式MozUserSelect(css:-moz-user-select)為none。?
這種方法只能禁止拖放對象本身被選擇。?
2.?
ie:document.selection.empty()?
ff:window.getSelection().removeAllRanges()?
兼容的寫法:?
window.getSelection ? window.getSelection().removeAllRanges() : document.selection.empty();?
這種方法不但不影響拖放對象的選擇效果,還能對整個文檔進行清除.
?摘自:
?http://www.javaeye.com/wiki/coos/1829-js-drag-and-drop-objects-prohibited-by-the-text-of-the-method-of-choice
轉載于:https://www.cnblogs.com/trance/archive/2010/01/25/1655598.html
總結
以上是生活随笔為你收集整理的禁止拖放对象文本被选择的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 个性签名女生简短好听
- 下一篇: window对象提供的功能之窗口最大化