/** * 屏蔽Alt+方向键、F5刷新、Ctrl + R、退格键、F11、Ctrl+N、Shift+F10、Alt+F4 * by liqing */ function document.onkeydown() { //屏蔽F6 if( event.keyCode == 117 ){ return false; } if ((window.event.altKey)&& ((window.event.keyCode==37)|| //屏蔽 Alt+ 方向键 ← (window.event.keyCode==39))) { //屏蔽 Alt+ 方向键 → // alert("不准你使用ALT+方向键前进或后退网页!"); event.returnValue=false; } if ((event.keyCode==116 || event.keyCode==117 )|| //屏蔽 F5 刷新键 (event.ctrlKey && event.keyCode==82) ){ //Ctrl + R event.keyCode=0; event.returnValue=false; } if ((event.keyCode==8)) {//屏蔽退格删除键 if(document.activeElement!=null) { //如果当前焦点不在文本框里,屏蔽退格删除键 if(document.activeElement.type!="text" && document.activeElement.type!="textarea" && document.activeElement.type!="password") { event.keyCode=0; event.returnValue=false; } //或者是 如果当前焦点在一个只读的文本框里,屏蔽退格删除键 else if(document.activeElement.readOnly) { event.keyCode=0; event.returnValue=false; } } } if (event.keyCode==122) {//屏蔽F11 event.keyCode=0;event.returnValue=false; } if (event.ctrlKey && event.keyCode==78) {//屏蔽 Ctrl+n event.returnValue=false; } if (event.shiftKey && event.keyCode==121) {//屏蔽 shift+F10 event.returnValue=false; } // if (window.event.srcElement.tagName=="A" && window.event.shiftKey) {//屏蔽 shift 加鼠标左键新开一网页(未实现) // window.event.returnValue = false; // } if (window.event.altKey && window.event.keyCode==115) { //屏蔽Alt+F4 window.showModelessDialog("about:blank","","dialogWidth:1px;dialogheight:1px"); return false; } } /** * 屏蔽 shift 加鼠标左键新开一网页 * by liqing */ function document.onclick() { //屏蔽 shift 加鼠标左键新开一网页 //@todo 目前禁止了shift+鼠标左键做任何事情,有更好的方法再换 if(event.shiftKey) { event.cancelBubble=true; return false; } } /** * 屏蔽 鼠标右键 * by liqing */ function document.oncontextmenu() { return false; } /** * 外部用户登录 */ var outeruserloginwindow; function outeruserlogin(ctfpath) { try{ if(outeruserloginwindow==null) { outeruserloginwindow=window.open(ctfpath+"/outeruserlogin.do", "outeruserlogin", "left=0,top=0,help=no,status=yes,scrollbars=yes,location=no,directories=no,copyhistory=no,toolbar=no, menubar=no"); outeruserloginwindow.resizeTo(screen.width,screen.height); } outeruserloginwindow.focus(); }catch(e){ outeruserloginwindow=window.open(ctfpath+"/outeruserlogin.do", "outeruserlogin", "left=0,top=0,help=no,status=yes,scrollbars=yes,location=no,directories=no,copyhistory=no,toolbar=no, menubar=no"); outeruserloginwindow.resizeTo(screen.width,screen.height); } }