Wall-E

Active Member
Credits
0
85 ❤︎ Bài viết: 168 Tìm chủ đề
Đọc: 2,004 Tìm: 0
Để chống bôi đen toàn bộ trang web - ở bất kỳ vị trí nào các bạn chèn đoạn code sau vào trong thẻ body trong CSS

Sử dụng CSS:

Mã:
-moz-user-select: none !important;
-webkit-touch-callout: none !important;
-webkit-user-select: none !important;
-khtml-user-select: none !important;
-moz-user-select: none !important;
-ms-user-select: none !important;
user-select: none !important;

Nếu chỉ muốn chống bôi đen ở 1 vị trí cụ thể trong trang web thì các bạn cần xác định class CSS của vị trí đó bằng cách view source HTML rồi chèn nó vào class đó.

Sử dụng Javascript:

Mã:
<script language='JavaScript1.2'>
function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>

Code javascript không cho click chuột phải:

Mã:
<script language='JavaScript'>
var msg="Welcome to BlOg FD";
function disableIE() {if (document.all) {alert(msg);return false;}
}
function disableNS(e) {
if (document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(msg);return false;}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);document.onmousedown=disableNS;
} else {
document.onmouseup=disableNS;document.oncontextmenu=disableIE;
}
document.oncontextmenu=new Function("alert(msg);return false")

</script>
 
Last edited by a moderator:
Từ khóa: Sửa

Những người đang xem chủ đề này

Xu hướng nội dung

Back