• 禁止右键


    禁止右键复制

    <script>
        //禁止右键
        document.writeln("<noscript><iframe src=""></iframe></noscript>");
        function getCookie(objName) {//获取指定名称的cookie的值
            var arrStr = document.cookie.split("; ");
            for (var i = 0; i < arrStr.length; i++) {
                var temp = arrStr[i].split("=");
                if (temp[0] == objName) return unescape(temp[1]);
            }
        }
        function addCookie(objName, objValue, objHours) {//添加cookie
            var str = objName + "=" + escape(objValue);
            if (objHours > 0) {//为0时不设定过期时间,浏览器关闭时cookie自动消失
                var date = new Date();
                var ms = objHours * 3600 * 1000;
                date.setTime(date.getTime() + ms);
                str += "; expires=" + date.toGMTString();
            }
            document.cookie = str;
        }
        if (location.href != getCookie("orderfrom")) {
            addCookie("orderfrom", location.href, 0);
        }
        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
        var omitformtags = ["input", "textarea", "select"]
        omitformtags = omitformtags.join("|")
        function disableselect(e) {
            if (omitformtags.indexOf(e.target.tagName.toLowerCase()) == -1){
                return false;
            }
        }
        function reEnable() {
            return true;
        }
        if (typeof document.onselectstart != "undefined")
            document.onselectstart = new Function("return false")
        else {
            document.onmousedown = disableselect;
            document.onmouseup = reEnable;
        }
        //获取订单地址
        var url=(window.location.href);
    </script>
  • 相关阅读:
    MVC模式在Java Web应用程序中的实例分析
    设计模式
    实现xxxxxxx系统六大质量属性战术
    阅读了《大型网站技术架构:核心原理与案例分析》,分析XX系统如何增加相应的功能,提高系统的可用性和易用性
    淘宝系统质量属性分析
    《架构漫谈》读后感
    软件架构师架构设计过程是什么?
    《架构之美》阅读笔记06
    《架构之美》阅读笔记05
    《架构之美》阅读笔记04
  • 原文地址:https://www.cnblogs.com/wzzl/p/4962501.html
Copyright © 2020-2023  润新知