document.onkeydown = function() { //屏蔽F5和F11 if ( window.event.keyCode == 116 || window.event.keyCode == 117 || window.event.keyCode == 122) { event.keyCode = 0; return false; } //屏蔽 Alt+ 方向键 ←,屏蔽 Alt+ 方向键 → if ((window.event.altKey) &&((window.event.keyCode == 37) || (window.event.keyCode == 39))) { return false; } //屏蔽CTRL+N if (window.event.ctrlKey && window.event.keyCode == 78) { return false; } //屏蔽CTRL+R if (window.event.ctrlKey && window.event.keyCode == 82) { return false; } //屏蔽CTRL+H if (window.event.ctrlKey && window.event.keyCode == 72) { return false; } //屏蔽CTRL+I if (window.event.ctrlKey && window.event.keyCode == 73) { return false; } //屏蔽SHIFT+F10 if (window.event.shiftKey && window.event.keyCode == 121) { return false; } //非编辑区屏蔽BACK SPACE if (window.event.keyCode == 8) { var e= window.event.srcElement; if ((e.tagName.toUpperCase() != "INPUT" && e.tagName.toUpperCase() != "TEXTAREA") || (e.type.toUpperCase() != "TEXT" && e.type.toUpperCase() != "PASSWORD" && e.type.toUpperCase() != "TEXTAREA" && e.type.toUpperCase()!="FILE") ||(!e.isContentEditable) || (e.disabled) ) { return false; } } } /* //非编辑区屏蔽右键菜单 document.oncontextmenu = function() { var e= event.srcElement; if ((e.tagName != "INPUT" && e.tagName != "TEXTAREA") || (e.type.toUpperCase() != "TEXT" && e.type.toUpperCase() != "PASSWORD" && e.type.toUpperCase() != "TEXTAREA" && e.type.toUpperCase() != "FILE")) //if (e.tagName != "INPUT" || e.type != "text") { return false; } } */ function delete_click() { return confirm("确定要删除吗?"); } window.onload =function() { if(getcookie("height")!=null) document.body.scrollTop=getcookie("height"); } window.onunload =function () { setcookie("height",document.body.scrollTop); } function getcookie(sName) { var aCookie = document.cookie.split("; "); for (var i=0; i < aCookie.length; i++) { var aCrumb = aCookie[i].split("="); if (sName == aCrumb[0]) return unescape(aCrumb[1]); } return null; } function setcookie(sName, sValue) { date = new Date(); date.setTime(date.getTime()+5000); //5 second document.cookie = sName + "=" + escape(sValue) + "; expires=" + date.toGMTString(); } function openwin(Name) { winSub=window.open(Name,'aaa','width=780,center=1,help=no,scrollbars=1,maxnimize=yes') ; winSub.focus(); } function get_cookie(Name) { var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) ; if (offset != -1) { offset += search.length end = document.cookie.indexOf(";", offset); if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)) ; alert(returnvalue); } } return returnvalue; } function loadpopup(Name,id) { if (get_cookie(id)=='') { openwin(Name) document.cookie=id+"=yes" } } function windowclose(id) { document.cookie(id)==''; } /* function window.onunload() { if (event.clientX < 0 && event.clientY < 0) window.showModalDialog('~/logout.aspx' ); } */ function GetXmlHttpObject() { //创建XMLHttpRequest对象来发送和接收HTTP请求与响应 xmlHttpObj = null; try { // FireFox Opera 8.0+ Safari xmlHttpObj = new XMLHttpRequest(); if(xmlHttpObj.overrideMimeType) { xmlHttpObj.overrideMimeType('text/xml'); } } catch(e) { // IE try { xmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP"); } catch(e) { xmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttpObj; } function StateChanged() { if(___xmlHttp.readyState == 4) { if(___xmlHttp.status == 200) { } else { } } } var ___xmlHttp=null; function ClearSession() { if(___xmlHttp==null) ___xmlHttp = GetXmlHttpObject(); if(___xmlHttp == null) return false; var url = "?___command=ClearSession&___clientRandom=" + Math.random(); ___xmlHttp.open("GET", url, true); ___xmlHttp.onreadystatechange = StateChanged; ___xmlHttp.send(null); } window.onbeforeunload = function() { var n = window.event.screenX - window.screenLeft; var b = n > document.documentElement.scrollWidth-20; if(b && window.event.clientY < 0 || window.event.altKey) { ClearSession(); } }