2011-02-16 68 views
-1

可能重複:
What is the best way to prevent highlighting of text when clicking on its containing div in javascript?從選擇的內容網頁上的Firefox停止

當用戶點擊並拖動你如何從突出自己的內容的firefox停止?

+0

作爲@TheifMaster所說,我們知道你有多接受的答案,你做得越多,就越有可能的是,*聰明的傢伙*會給你一個答案。 (`smart!= nice`)您可以通過點擊* down vote *按鈕下方的**複選標記**來完成此操作。 – 2011-02-16 22:50:45

回答

1

如果您正在使用您的網頁上的jQuery UI,你可以簡單地使用$('body').disableSelection();

如果沒有,試試這個(這是disableSelection()一樣):

var elem = document.body; 
elem.onselectstart = function() { return false; }; 
elem.MozUserSelect = 'none'; 
elem.unselectable = 'on';