zoukankan      html  css  js  c++  java
  • textarea屏蔽文本粘贴功能

    //屏蔽右键菜单
    document.oncontextmenu = function (event) {
        if (window.event) {
            event = window.event;
        }
        try {
            var the = event.srcElement;
            if (!((the.tagName == "INPUT" && the.type.toLowerCase() == "text") || the.tagName == "TEXTAREA")) {
                return false;
            }
            return true;
        } catch (e) {
            return false;
        }
    };
    //屏蔽Ctrl+V
    document.onkeydown=function(ev){
        var ev=window.event||ev;
        var code=ev.keyCode||ev.which||ev.charCode;
        if((ev.ctrlKey) && (code==86)){
            ev.returnValue=false;
            //alert("Ctrl+V被禁止啦!");
        }
    };
  • 相关阅读:
    手工测试
    测试理论
    MySQL常用语法
    Linux设置静态ip
    设计模式
    Shiro
    TreeSet和TreeMap
    UDP和反射
    Linux归纳
    Spring+SpringMVC+Mybatis整合
  • 原文地址:https://www.cnblogs.com/liuliang1999/p/13822290.html
Copyright © 2011-2022 走看看