把下列代码放到<body></body>或者<head></head>之间
一、禁止点鼠标右键1.<script LANGUAGE="JavaScript">
function click() { if (event.button==2)
{alert('你好,右键已被禁止使用'); } } document.onmousedown=click
</script>
二、禁止点击鼠标右键2:
<SCRIPT language=JavaScript>
<!--
file://锁鼠标右键和键盘CONTEXTMENU键
function click(e) {
if (document.all) {
if (event.button==2||event.button==3) { alert("欢迎光临优内建站网,有什么需要帮忙的话,请与站长联系!谢谢您的合作!!!");
oncontextmenu='return false';
}
}
if (document.layers) {
if (e.which == 3) {
oncontextmenu='return false';
}
}
}
if (document.layers) {
document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;
document.oncontextmenu = new Function("return false;")
// -->
</SCRIPT>
三、禁止点击鼠标右键3
<!--将以下代码加入HTML的<HEAD></HEAD>之间-->
<script language="javascript">
function click() {
if (event.button==2) {
alert('欢迎光临优内建站网,有什么需要帮忙的话,请与站长联系!谢谢您的合作!!!')
}
}
document.onmousedown=click
</script>
三、动右键等于添加到收藏夹4
<SCRIPT language=JavaScript>
function click() { if (event.button==2)
{window.external.addFavorite('http://www.cck5.com','优内建站网'); } } document.onmousedown=click
</SCRIPT>
四.禁用左和右键[新]
<SCRIPT LANGUAGE=javascript>
function click() {
alert('禁止你的左键复制!') }
function click1() {
if (event.button==2) {alert('禁止右键点击~!') }}
function CtrlKeyDown(){
if (event.ctrlKey) {alert('不当的拷贝将损害您的系统!') }}
document.onkeydown=CtrlKeyDown;
document.onselectstart=click;
document.onmousedown=click1;
</SCRIPT>
五。禁右键(用ctrl+v键复制)
<!---YeJun2605.AnyP.cn-//-->
<script language="JavaScript">
<!--
if (window.Event)
document.captureEvents(Event.MOUSEUP);
function nocontextmenu()
{
event.cancelBubble = true
event.returnValue = false;
return false;
}
function norightclick(e)
{
if (window.Event)
{
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
file://-->
</script>
六。点右键出现收藏夹
<script language=JavaScript1.2>
if (document.all)
document.body.onmousedown=new Function("if (event.button==2||event.button==3)window.external.addFavorite('http//www.cck5.com','优内建站网')")
</script>