Chinaunix首页 | 论坛 | 博客
  • 博客访问: 109589
  • 博文数量: 36
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 330
  • 用 户 组: 普通用户
  • 注册时间: 2014-08-18 23:16
文章分类
文章存档

2016年(7)

2015年(20)

2014年(9)

我的朋友

分类: JavaScript

2015-03-10 16:07:33

//屏蔽右键菜单
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;
    }
} 
//屏蔽粘贴 
document.onpaste = 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;
    }
} 
//屏蔽复制 
document.oncopy = 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;
    }
} 
//屏蔽剪切 
document.oncut = 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;
    }
} 
//屏蔽选择 
document.onselectstart = 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;
    }
}

阅读(839) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~