Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Disable Click effect on web page.

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 315
    Comment on it

    Hello everyone,

    Today, We will discuss that how to disable click effect on the web page so that we can protect our html.

    Using javascript we can disable the click effect on the web page. But this is not most difficult way to protect the HTML, we have three way to protect the html code using javascript:-

        1) Encoding the source code.

        2)Put the bulk of the source code in a JavaScript include.

        3)Disabled  click effect.

    so we are going to know the third option.

    No Right Click

       JAVASCRIPT:-

     <SCRIPT LANGUAGE="javascript">
    
    function click() {
    if (event.button==2) {
    alert('Sorry, this function is disabled.')
    }
    }
    document.onMouseDown=click
    </SCRIPT> 

    As we know, event.button is and 2 simply represent the right button of the mouse.

    No Left Click :- 

    <SCRIPT LANGUAGE="javascript">
    
    function click() {
    if (event.button==1) {
    alert('No clicking!')
    }
    }
    document.onMouseDown=click
    
    </SCRIPT>

    No Clicking At All!:-

    <SCRIPT LANGUAGE="javascript">
    
    function click() {
    if (event.button==1 || event.button==2) {
    alert('No clicking!')
    }
    }
    document.onMouseDown=click
    
    </SCRIPT> 

     

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: