javascript在元素内部禁止复制

var div=document.getElementById("container");
      EventUtil.addHandler(div,"keydown",function(event){
        var event=EventUtil.getEvent(event);
        var charCode=EventUtil.getCharCode(event);
        if(String.fromCharCode(charCode)=="c" || event.ctrlKey)
        {
          console.log(1);
          EventUtil.preventDefault();
        }else
        {
          console.log("efdf");
        }
      });

你可能感兴趣的:(javascript学习日记,javascript,前端,开发语言)