1dners

Disable Highlighting of Text

Jul 31st, 2012
279
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. <script type="text/javascript">
  2.  
  3. /***********************************************
  4. * Disable select-text script- © Dynamic Drive (www.dynamicdrive.com)
  5. * This notice MUST stay intact for legal use
  6. * Visit http://www.dynamicdrive.com/ for full source code
  7. ***********************************************/
  8.  
  9. //form tags to omit in NS6+:
  10. var omitformtags=["input", "textarea", "select"]
  11.  
  12. omitformtags=omitformtags.join("|")
  13.  
  14. function disableselect(e){
  15. if (omitformtags.indexOf(e.target.tagName.toLowerCase())==-1)
  16. return false
  17. }
  18.  
  19. function reEnable(){
  20. return true
  21. }
  22.  
  23. if (typeof document.onselectstart!="undefined")
  24. document.onselectstart=new Function ("return false")
  25. else{
  26. document.onmousedown=disableselect
  27. document.onmouseup=reEnable
  28. }
  29.  
  30. </script>
Advertisement
Add Comment
Please, Sign In to add comment