Cho trang HTMLThêm vào ở giữa thẻ body tag ~<body></body>
- Code:
-
<script language=JavaScript>
<!--
//Disable right mouse click Script
//By Mark Nguyen (robot_boy2018@yahoo.com)
var message="Click Disabled";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
Có thể thay thế nội dung bằng cách tìm dòng đó trên đoạn code trên và sửa phần tô đậm
- Trích dẫn :
- var message="Click Disabled";
Demo:
[You must be registered and logged in to see this link.]Code này dành cho các bạn không muốn popup
- Code:
-
<BODY oncontextmenu="return false"<script language=JavaScript>
<!--
//Disable right mouse click Script
//By Mark Nguyen (robot_boy2018@yahoo.com)
var message="Click Disabled";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
</body>
Demo:
[You must be registered and logged in to see this link.]Cho forum
Vào Administration Panel=>General Tab=>Forum=>Configuration=>General=>Site description
Thêm code này vào
- Code:
-
//Disable right mouse click Script
//By Mark Nguyen (robot_boy2018@yahoo.com)
<script language=Javascript1.2> function ejs_nodroit() { alert('Text Here');
return(false); } document.oncontextmenu = ejs_nodroit; </script>
Đổi phần "Test Here" thành nội dung muốn hiện trong popup
Code này dành cho các bạn không muốn popup
- Code:
-
//Disable right mouse click Script
//By Mark Nguyen (robot_boy2018@yahoo.com)
<BODY oncontextmenu="return false"<script language=Javascript1.2> function ejs_nodroit() { alert('Text Here');
return(false); } document.oncontextmenu = ejs_nodroit; </script>
</body>
Nguồn : CP