ด้วยสํานึกในพระมหากรุณาธิคุณสมเด็จพระนางเจ้าสิริกิติ์เป็นล้นพ้นอันหาที่สุดมิได้


ป้องกันคนคลิกขวา และ ป้องกันคน select ข้อความ

เขียนเมื่อ 17 ปีก่อน โดย Ninenik Narkdee
right click ข้อความ select

คำสั่ง การ กำหนด รูปแบบ ตัวอย่าง เทคนิค ลูกเล่น การประยุกต์ การใช้งาน เกี่ยวกับ right click ข้อความ select

ดูแล้ว 9,764 ครั้ง


แทรกโค๊ดนี้ในส่วนของแท็ก <head>

 

<!--ป้องกันคนคลิกขวา-->
<script type="text/javascript">
var message="";
function clickIE(){
	if(document.all){
		(message);
		return false;
	}
}
function clickNS(e){
	if (document.layers || (document.getElementById && !document.all)){
		if (e.which==2||e.which==3){
			(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>
<!--ป้องกันคน select ข้อความ-->
<script type="text/javascript">
function disableselect(e){
	if (window.sidebar){
		var objName=e.target.nodeName;
		if(objName!="INPUT" && objName!="TEXTAREA"){
			return false
		}
	}else{
		return false
	}
}

function reEnable(){
	return true
}
 document.onselectstart=new Function ("return false")
 if (window.sidebar){
  document.onmousedown=disableselect
  document.onclick=reEnable
 }
</script>

 



กด Like หรือ Share เป็นกำลังใจ ให้มีบทความใหม่ๆ เรื่อยๆ น่ะครับ











URL สำหรับอ้างอิง










เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ