Un title page

สวัสดีครับเพื่อนๆ ผมว่างจากเรียนลองส่งบทความมาให้อ่านกัน พอดีผมไปเจอ Script จากเว็บ houvthak.siamservices.com มี Script ให้เราเลือกใช้กันมากมาย ไม่พูดมากดีกว่า บทความที่ผมเขียนนี้เป็นการ Lock หน้าเว็บไม่ให้ Click ขวา เพื่อนๆ ว่าดีไหม กันหน้าเว้บเราได้ด้วย แต่คงไม่ได้ 100 % นะครับบางส่วนก็ยังดี อิอิ!

ขั้นตอนการทำ

1. เพื่อนๆต้องเปิดหน้าเว็บที่อยาก Lock ขึ้นมาก่อนนะ แล้วนำโค้ดนี้ไปวางในส่วนของ Head นะครับ

<!--www.houvthak.com-->
<SCRIPT language=JavaScript1.2>
<!--

/*
No Right Click
by: CyBerShOlT http://cybersholt.da.ru
*/

if (window.Event) // Only Netscape will have the CAPITAL E.
document.captureEvents(Event.MOUSEUP); // catch the mouse up event

function nocontextmenu() // this function only applies to IE4, ignored otherwise.
{
event.cancelBubble = true
event.returnValue = false;

return false;
}

function norightclick(e) // This function is used by all others
{
if (window.Event) // again, IE or NAV?
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}

}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</SCRIPT>

2. ถ้าเพื่อนๆงงดูตัวอย่างการวาง Script

<html>
<head>
<title>Un title page</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<!--www.houvthak.com-->
<SCRIPT language=JavaScript1.2>
<!--

/*
No Right Click
by: CyBerShOlT http://cybersholt.da.ru
*/

if (window.Event) // Only Netscape will have the CAPITAL E.
document.captureEvents(Event.MOUSEUP); // catch the mouse up event

function nocontextmenu() // this function only applies to IE4, ignored otherwise.
{
event.cancelBubble = true
event.returnValue = false;

return false;
}

function norightclick(e) // This function is used by all others
{
if (window.Event) // again, IE or NAV?
{
if (e.which == 2 || e.which == 3)
return false;
}
else
if (event.button == 2 || event.button == 3)
{
event.cancelBubble = true
event.returnValue = false;
return false;
}

}

document.oncontextmenu = nocontextmenu; // for IE5+
document.onmousedown = norightclick; // for all others
//-->
</SCRIPT>

</head>

<body bgcolor="#FFFFFF">

</body>
</html>

3. หลังจากนั้นก็ลองทดสอบดูนะครับ อิอิ ผมว่าคลิกขวาไม่ได้แน่ ติชมกันได้นะครับเผื่อผมเขียนไม่ดี