在JavaScript中禁用了右键单击 [英] Right Click disabled in JavaScript
本文介绍了在JavaScript中禁用了右键单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
团队,
感谢您解决疑惑的兴趣.顺便问一下,能否请您在javascript中提供禁止右键单击"代码,以用于简单的登录应用程序.
要求:当我们右键单击密码字段时,警报消息应显示为禁用右键单击.
请充分执行此操作.
谢谢
Hi Team,
Your interest in solving doubts is appreciated.By the way,Could you please provode "Right click disabled" code in javascript for simple login application.
Requirement:When we Right click on password field,the alert message should be displayed as right click disabled.
Please do this needfull.
Thanks
推荐答案
看这里:
在asp.net文本框中使用javascript禁用复制粘贴右键单击 [ ^ ]
在文本框中禁用右键单击 [ ^ ]
禁用右键单击 [
Look here:
Disable copy paste right click using javascript in asp.net textbox[^]
Disable right click in textbox[^]
Disable Right click[^]
您必须使用以下解决方案:
客户端:
You have to do use the following solution:
Client Side:
<script>
function DisableRightClick(event) {
if (event.button == 2) { //For mouse right click
alert("Sorry, Right Click not allowed!!!");
}
}
</script>
服务器端:
Server Side:
if (!Page.IsPostBack)
{
TextBox1.Attributes.Add("onmousedown", "DisableRightClick(event)");
}
这篇关于在JavaScript中禁用了右键单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文