zoukankan      html  css  js  c++  java
  • 禁止右键二种方法

    一、jquery

    <script type="text/javascript">
        $(document).ready(function() {
            $(document).bind("contextmenu", function(e) {
                return false;
            });

    //            $(document).bind("selectstart", function(e) {
    //                return false;
    //            });

    //            $(document).bind("onpaste", function(e) {
    //                return false;
    //            });


        });
    </script>

    二、javascript

     <noscript>
            <iframe src="jz.htm"></iframe>
        </noscript>

        <script language="JavaScript">
    <!--

            function key() {
                if (event.shiftKey) {
                    window.close();
                }
                //禁止shift
                if (event.altKey) {
                    window.close();
                }
                //禁止alt
                if (event.ctrlKey) {
                    window.close();
                }
                //禁止ctrl
                return false;
            }
            document.onkeydown = key;
            if (window.Event)
                document.captureEvents(Event.MOUSEUP);
            function nocontextmenu() {
                event.cancelBubble = true
                event.returnValue = false;
                return false;
            }
            function norightclick(e) {
                if (window.Event) {
                    if (e.which == 2 || e.which == 3)
                        return false;
                }
                else
                    if (event.button == 2 || event.button == 3) {
                    event.cancelBubble = true
                    event.returnValue = false;
                    return false;
                }
            }
            //禁止右键
            document.oncontextmenu = nocontextmenu;  // for IE5+
            document.onmousedown = norightclick;  // for all others
    //-->
        </script>

  • 相关阅读:
    头脑王者 艺术,电影,体育,时尚,动漫
    头脑王者 音乐
    头脑王者 地理
    头脑王者 历史,军事
    头脑王者 文学
    Jenkins project
    sql server drop login failed
    devenv.exe 编译Solution
    Jenkins
    头脑王者
  • 原文地址:https://www.cnblogs.com/zwei1121/p/1793810.html
Copyright © 2011-2022 走看看