Posted By

stephcode on 06/04/11


Tagged

image disable dragging right-click


Versions (?)

Disable right-clicking, image dragging, pretty much everything, etc.


 / Published in: JavaScript
 

Annoy your visitors, fool your friends, fun and party. Please note that this also disables ability to write in form fields.

  1. <SCRIPT LANGUAGE="JavaScript">
  2. <!-- Disable
  3. function disableselect(e){
  4. return false
  5. }
  6.  
  7. function reEnable(){
  8. return true
  9. }
  10.  
  11. //if IE4+
  12. document.onselectstart=new Function ("return false")
  13. document.oncontextmenu=new Function ("return false")
  14. //if NS6
  15. if (window.sidebar){
  16. document.onmousedown=disableselect
  17. document.onclick=reEnable
  18. }
  19. //-->
  20. </script>

Report this snippet  

You need to login to post a comment.