如何在IE,Netscape 4和Netscape 6中禁用右键菜单 [英] How to disable right click menu in IE, Netscape 4 and Netscape 6

查看:76
本文介绍了如何在IE,Netscape 4和Netscape 6中禁用右键菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这解释了如何禁用

Netscape 4,Netscape 6和Internet Explorer(IE)中的视图源/右键菜单。


< ; script language =" JavaScript">

//此代码是右键单击禁用的开始

函数右(e){

//此功能适用于Net 4.

if(navigator.appName ==''Netscape''&&(e.which == 3 || e.which ==

2))

{

返回false;

}

返回true;

}


函数context(){

//这个函数负责Net 6和IE。

返回false;

}


document.onmousedown =权利;

document.oncontextmenu = context;

< / script>


注意:如果你设置了一个框架页面,并且在每个框架中都包含上面的

代码,临时用户将无法查看来源。如果你使用

帧,浏览器菜单选项查看源代码只会查看主要的

帧页面源,而不是单个帧源。但是,任何

复杂的用户仍然可以通过关闭javascript或者使用无法识别的浏览器来查看所有来源。 >
这个脚本。


注意:只有在Windows XP机器上测试过,运行风险自负。你可能需要调整其他平台/浏览器的代码,但你可以从这个样本中得到这个想法。


我发布这个的原因是新手

很难在网上找到这些信息,因为有大量的帖子

声明这个不可能,以及同样数量巨大的帖子

严厉谴责这是你可以对网页做的最糟糕的事情。

这篇帖子适合那些只想要的人满足客户的需求
。即使请求是一个坏主意,客户仍然支付

账单:)

解决方案

2003年7月9日07 :53:00-0700, ya*******@yahoo.com (yaktipper)写道:

注意:仅在Windows XP计算机上进行测试,运行风险自负。你可能需要调整其他平台/浏览器的代码,但是你可以从这个样本中得到这个想法。

我发布这个的原因就是它对于一个新手来说很难在网上找到这些信息,但是,你没有帮助新手,因为你自愿承认你没有

在几个浏览器之外进行了测试(忽略了流行的浏览器,例如

IE5)

因为大量的帖子宣称这是不可能的,


我从来没有看到它在你说的浏览器中宣布不可能

关于,群组FAQ甚至涵盖了如何阻止弹出菜单(它

不包括NN4,但是NN4几乎不用,与其他

浏览器相比,你的例子并没有覆盖)

这篇文章适合那些只想满足顾客需求的人。即使请求是个坏主意,客户仍然需要支付账单:)




是的,但如果你做得好,客户会更好地评判你,不是他们在第一名要求的未受过教育的b
$ b。无论哪种方式,他们仍然支付账单,但如果他们得到一份好工作 - 他们建议你

其他人。


吉姆。

-

comp.lang.javascript常见问题 - http://jibbering.com/faq/


ya ******* @ yahoo.com 说:

即使请求是个坏主意,客户仍然付款
账单:))




你整晚收费多少?


< blockquote> yaktipper写道:

这解释了如何在Netscape 4,Netscape 6和Internet Explorer(IE)中禁用视图源/右键菜单。


无效。
http ://stone.thecoreworlds.net/www/hide/

我发布这个的原因是新手很难找到这些信息在网上


不,很容易: http://search.yahoo.com/bin/search?p=block+right+click

,因为大量的帖子声明了这一点不可能


不,他们不会 - 他们宣称它无用且令人生气。

和同样数量巨大的帖子尖刻地谴责这是你可以对网页做最糟糕的事情。


这不是,但它确实很接近。

这篇帖子适合那些只想满足顾客需求的人$>需要




我以为是新手?新手不应该有顾客,他们应该学习。
-

David Dorward http://david.us-lot.org/

重新设计正在进行中: http://stone.thecoreworlds.net/

微软宣布IE死了(所以升级):
http://minutillo.com/steve/weblog/20...ces-ie-is-dead


This explains how to disable the view source / right-click menu in
Netscape 4, Netscape 6 and Internet Explorer (IE).

<script language="JavaScript">
//This code is the beginning of the right click disable
function right(e) {
//This function is for Net 4.
if (navigator.appName == ''Netscape'' && (e.which == 3 || e.which ==
2))
{
return false;
}
return true;
}

function context(){
//This function takes care of Net 6 and IE.
return false;
}

document.onmousedown=right;
document.oncontextmenu=context;
</script>

Note: If you set up a frame page, and in each frame include the above
code, the casual user will not be able to view the source. If you use
frames, the browser menu option "View Source" will only view the main
frame page source, not the individual frame source. However, any
sophisticated user will be able to still view all the source simply by
turning off javascript, or by using a browser that doesn''t recognize
this script.

Note: Only tested on a Windows XP machine, run at your own risk. You
may need to tweak the code for other platforms/browers, but you can
get the idea from this sample.

The reason I''m posting this is that it is very difficult for a novice
to find this information on the Net, as an immense amount of posts
declare this as impossible, and an equally immense amount of posts
scathingly denounce this as the worst thing you can do to a web page.
This post is for those people that simply want to meet a customer''s
needs. Even if the request is a bad idea, customers still pay the
bills :)

解决方案

On 9 Jul 2003 07:53:00 -0700, ya*******@yahoo.com (yaktipper) wrote:

Note: Only tested on a Windows XP machine, run at your own risk. You
may need to tweak the code for other platforms/browers, but you can
get the idea from this sample.

The reason I''m posting this is that it is very difficult for a novice
to find this information on the Net,
Yet, you''ve not helped the novice, as you freely admit you''ve not
tested this beyond a couple of browsers (ignoring popular ones like
IE5)
as an immense amount of posts declare this as impossible,
I''ve never seen it declared impossible in the browsers you''re talking
about, the groups FAQ even covers how to block the popup menu (it
doesn''t cover NN4, but then NN4 is hardly used, compared with other
browsers your example doesn''t cover)
This post is for those people that simply want to meet a customer''s
needs. Even if the request is a bad idea, customers still pay the
bills :)



Yes, but customers judge you better if you do a good job, not the
uneducated bodge they asked for in the 1st place. Either way they
still pay the bill, but if they get a good job - they recommend you to
others.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/


ya*******@yahoo.com said:

Even if the request is a bad idea, customers still pay the
bills :)



How much do you charge for all night?


yaktipper wrote:

This explains how to disable the view source / right-click menu in
Netscape 4, Netscape 6 and Internet Explorer (IE).
Ineffective.
http://stone.thecoreworlds.net/www/hide/
The reason I''m posting this is that it is very difficult for a novice
to find this information on the Net
No, its easy: http://search.yahoo.com/bin/search?p=block+right+click
, as an immense amount of posts declare this as impossible
No they don''t - they declare it useless and irritating.
and an equally immense amount of posts scathingly denounce this as the
worst thing you can do to a web page.
It isn''t, but it certainly comes close.
This post is for those people that simply want to meet a customer''s
needs



I thought it was for novices? Novices shouldn''t have customers, they should
be learning.
--
David Dorward http://david.us-lot.org/
Redesign in progress: http://stone.thecoreworlds.net/
Microsoft announces IE is dead (so upgrade):
http://minutillo.com/steve/weblog/20...ces-ie-is-dead


这篇关于如何在IE,Netscape 4和Netscape 6中禁用右键菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆