屏蔽F5和右键
<script type="text/javascript">
function document.onkeydown() {
if (event.keyCode == 116) {
event.keyCode = 0;
event.cancelBubble = true;
return false;
}
}
document.oncontextmenu = function (e) {
return false;
}
</script>
//屏蔽鼠标右键
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>屏蔽键盘鼠标部分功能</title>
<style>
body{
margin:0;
padding:0;
}
#do{
width:100%;
border-top:1px solid #f00;
/*border-bottom:1px solid #f00;*/
}
</style>
</head>
<body id="do">1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
1111111111111111111111111111111111<br />
<script>
addDOMLoadEvent(function(){
shielded();
});
var shielded = function(){
if(document.getElementById("do").clientHeight > document.documentElement.clientHeight)
{
document.getElementById("do").style.height = document.getElementById("do").clientHeight;
}
else{
document.getElementById("do").style.height= document.documentElement.clientHeight+"px";
}
var myName = document.getElementById("do");
/*myName.onmouseup = function(){
return false;
}
myName.ondragstart = function(){
return false;
}*/
myName.oncontextmenu = function(){
return false;
}
/*myName.οnmοusemοve= function(){
return false;
}
myName.οncοpy= function(){
return false;
}
myName.onselectstart = function(){
return false;
}
myName.onselect = function(){
return false;
}
myName.onmousedown = function(){
return false;
}*/
}
function addDOMLoadEvent(func) {
if (!window.__load_events) {
var init = function () {
// quit if this function has already been called
if (arguments.callee.done) return;
// flag this function so we don't do the same thing twice
arguments.callee.done = true;
// kill the timer
if (window.__load_timer) {
clearInterval(window.__load_timer);
window.__load_timer = null;
}
// execute each function in the stack in the order they were added
for (var i=0;i < window.__load_events.length;i++) {
window.__load_events[i]();
}
window.__load_events = null;
};
// for Mozilla/Opera9
if (document.addEventListener) {
document.addEventListener("DOMContentLoaded", init, false);
}
// for Internet Explorer
/*@cc_on @*/
/*@if (@_win32)
document.write("<scr"+"ipt id=__ie_onload defer src=//0><\/scr"+"ipt>");
var script = document.getElementById("__ie_onload");
script.onreadystatechange = function() {
if (this.readyState == "complete") {
init(); // call the onload handler
}
};
/*@end @*/
// for Safari
if (/WebKit/i.test(navigator.userAgent)) { // sniff
window.__load_timer = setInterval(function() {
if (/loaded|complete/.test(document.readyState)) {
init(); // call the onload handler
}
}, 10);
}
// for other browsers
window.onload = init;
// create event function stack
window.__load_events = [];
}
// add function to event stack
window.__load_events.push(func);
}
</script>
</body>
</html>