ansmall.com
選擇貨幣單位

如何防止自己的文章被別人盜用?

function disableMouseSelection(element){
  if (element.onselectstart !== undefined){
    element.onselectstart = function(){return false};
  }
  else if (element.style.MozUserSelect !== undefined){
    element.style.MozUserSelect = "none";
  }
  else if (element.style.KhtmlUserSelect !== undefined){
    element.style.KhtmlUserSelect = "none";
  }
  else {
    element.onmousedown = function(){return false};
  }
  if (element.ondrag !== undefined){
    element.ondrag = function(){return false};
  }
}
disableMouseSelection(document.documentElement);

如果不想自己網站的文章被人複制了去,可以在寫文章的時候,點“源代碼”加入以上代碼

配合下面這個屏蔽右鍵的代碼效果更好,正是居家旅行必備工具

function click() {
if (event.button==2) {
alert('感謝您對Ansmall.com的支持')
}
}
document.onmousedown=click