<!-- Disable Copy and Paste-->
<script language='JavaScript1.2'>
function disableselect(e){
return false
}
function reEnable(){
return true
}
document.onselectstart=new Function ("return false")
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>
ห้ามลากดำ+ห้าม ctrl+A,C ในโค้ดเดียว
<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>
ห้ามคลิกขวา
**แทนข้อความที่ต้องการให้ปรากฏ Do not click right..!!
<script language=JavaScript>
<!--
var message="Do not click right..!!";
///////////////////////////////////
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(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=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>
ห้ามคลิกขวา
ไม่ให้ปรากฏข้อความใดๆ
<script language=JavaScript>
<!--
///////////////////////////////////
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(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=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}
document.oncontextmenu=new Function("return false")
// -->
</script>
วางก่อน Tag </head>
<script type="text/javascript">
function disableSelection(target){
if (typeof target.onselectstart!="undefined") //For IE
target.onselectstart=function(){return false}
else if (typeof target.style.MozUserSelect!="undefined") //For Firefox
target.style.MozUserSelect="none"
else //All other route (For Opera)
target.onmousedown=function(){return false}
target.style.cursor = "default"
}
</script>
วางก่อน Tag </body>
<script type="text/javascript">
disableSelection(document.body)
</script>
เพิ่มโค๊ดชุดนี้เข้าที่ footer.php
<script type="text/javascript">
document.addEventListener('copy', function(e){
e.clipboardData.setData('text/plain', 'Original Content By CodingDee.com\r\n');
e.preventDefault();
});
</script>
ไว้ที่ head
<script language=JavaScript>
<!--
var message="สนใจเรียนได้น่ะ";
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>
<script language="JavaScript1.2">
//Disable select-text script (IE4 , NS6 )
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>