본문 바로가기
Developer/Javascript & jQuery

[Javascript] 마우스 오른쪽버튼 막기

by 순수한소년 2017. 1. 29.
728x90
반응형
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
    function clickEvent(e) {
        if (e.which == 3) {
            alert("소스를 볼 수 없습니다.");
            return false;
        }
    }
 
    function click() {
        if ((event.button == 2|| (event.button == 3)) {
            alert("소스를 볼 수 없습니다.")
        }
    }
 
    if (document.layers) {
        document.captureEvents(Event.MOUSEDOWN);
        document.onmousedown = clickEvent;
    }
    if (document.all) {
        document.onmousedown = click;
    }
</SCRIPT>
</HEAD>
<BODY BGCOLOR="black">
    <TABLE WIDTH="100%" HEIGHT="100%">
        <TR>
            <TD VALIGN="top">
                <FONT COLOR="white" SIZE="5">마우스 오른쪽 버튼을 눌러보세요.</FONT>
            </TD>
        </TR>
        <TR>
            <TD ALIGN="center" VALIGN="middle">
                <A HREF="#" onfocus="this.blur()"><IMG SRC="dot.jpg" BORDER="0"></A>
            </TD>
        </TR>
    </TABLE>
</BODY>
</HTML>
 
cs


마우스 오른쪽 버튼을 눌러보세요.
728x90
반응형