In this post i will show how to disable mouse right click using JavaScript.
1. Below is the code to disable the right click.
<script language="javascript" type="text/javascript">
var message = "Copyright Chandanprogramming";
document.oncontextmenu = new Function("alert(message);return false")
</script>
2. Another way of doing the same in JavaScript.
Use this below code :
<script language="javascript" type="text/javascript">
document.onmousedown=rightClickFunction;
var message = "Copyright Chandanprogramming";
function rightClickFunction(e)
{
if(event.button==2)
{
alert(message); return false;
}
}
</script>
Execute your project and test the required output.
No comments:
Post a Comment