Click here to Skip to main content
15,036,654 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.

Makes little to no sense. Why doing so?

You have to do use the following solution:

Client Side:

    function DisableRightClick(event) {

        if (event.button == 2) {  //For mouse right click
            alert("Sorry, Right Click not allowed!!!");

Server Side:

if (!Page.IsPostBack)
                TextBox1.Attributes.Add("onmousedown", "DisableRightClick(event)");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900