html picture disable right click

Solutions on MaxInterview for html picture disable right click by the best coders in the world

showing results for - "html picture disable right click"
Isidora
30 Oct 2020
1<script type="text/javascript">
2    var message="Function Disabled!";
3
4    function clickIE4(){
5        if (event.button==2){
6            alert(message);
7            return false;
8        }
9    }
10
11    function clickNS4(e){
12        if (document.layers||document.getElementById&&!document.all){
13            if (e.which==2||e.which==3){
14                alert(message);
15                return false;
16            }
17        }
18    }
19
20    if (document.layers){
21        document.captureEvents(Event.MOUSEDOWN);
22        document.onmousedown=clickNS4;
23    }
24    else if (document.all&&!document.getElementById){
25        document.onmousedown=clickIE4;
26    }
27
28    document.oncontextmenu=new Function("alert(message);return false")
29</script>