aspx Tutorial

NET Articles,jQuery demo, asp.net with jQuery, online tutorial,Jquery, SilverLight, Javascript, asp.net,JSON, MVC,.NET Articles,demo, Web Services,
Advertise Here

Toolbar

Get our toolbar!

Advertize



Posted by Aamir Hasan   on Friday, September 7, 2012 Total Views:  

In this example, you will see how to disable right click on HTML div. To prevent user by right click on HTML div, we can disable right on HTML div by using oncontextmenu event provide to disable right click.

Example

<!DOCTYPE html>

<html>

<head runat="server">

    <title>Disable right click on HTML div</title>

    <style>

        html, body

        {

            font-family: Arial;

            font-size: 90%;

            color: #888;

            line-height: 1.5em;

            background-color: #FFF5FF;

        }

       

        .secret

        {

            border: 1pxsolid#aaa;

            display: block;

            width: 200px;

            height: 100px;

            padding: 10px;

            background-color: #FFFFCF;

            margin: 10px;

        }

    </style>

</head>

<body>

    <form id="form1" runat="server">

        <div class="secret" oncontextmenu="return false;">Your ASP.NET Control</div>

        <div class="secret" oncontextmenu="return false;">

            <p>

                <asp:HyperLink ID="HyperLink1" NavigateUrl="http://www.aspxtutorial.com"

                    runat="server" Target="_blank">jquery with asp.net</asp:HyperLink>

                <asp:HyperLink ID="HyperLink2" NavigateUrl="http://www.aspxtutorial.com"

                    runat="server" Target="_blank">asp.net examples</asp:HyperLink>

            </p>

 

        </div>

    </form>

</body>

</html>

 


Output

Download

Disable-Right-ClickonControl.aspx (888.00 bytes)

Demo

 See live demo

Protected by Copyscape Online Plagiarism Tool

Comments (4) -

Joe
Joe United States
9/7/2012 8:56:07 AM #

Exceellent.

soccer shoes
soccer shoes United States
5/26/2013 6:29:05 PM #

<a href="www.soccershoesu.com/.../adidas-soccer-cleats">Adidas Soccer Cleats</a>

soccer shoes
soccer shoes United States
5/26/2013 6:29:24 PM #

<a href="www.soccershoesu.com/.../adipure-iv-trx">AdiPURE IV TRX</a>

soccer shoes
soccer shoes Slovenia
7/17/2013 11:34:47 PM #

www.soccershoesu.com/us/maestri-de-nike-ctr360

Cheap wholesale nfl jerseys
Cheap wholesale nfl jerseys United States
9/5/2015 11:31:17 PM #

<a href="www.onhold.on.ca/css/wp-jersey.html">nike nfl jerseys wholesale</a>

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

Advertizement 1
Advertizement 2
Advertizement 3
Advertizement 4
Advertizement 5