www.gusucode.com > JSP ExtJS图书管理系统源码程序 > JSP ExtJS图书管理系统/reg_login/hand-in.js
function addLoadListener(fn) { if(typeof window.addEventListener !='undefined') { window.addEventListener('load',fn,false); } else if(typeof document.addEventListener !='undefined') { document.addEventListener('load',fn,false); } else if(typeof window.attachEvent !='undefined') { window.attachEvent('onload',fn); } else{ var oldfn=window.onload; if(typeof window.onload !='function') { window.onload=fn; } else { window.onload=function() { oldfn(); fn(); }; } } } function getElementsByAttribute(attribute,attributeValue) { var elementArray =new Array(); var matchedArray =new Array(); if(document.all) { elementArray=document.all; } else { elementArray=document.getElementsByTagName("*"); } for( var i=0;i<elementArray.length;i++) { if(attribute=="class") { var pattern=new RegExp("(^| )"+attributeValue+"( |$)"); if(pattern.test(elementArray[i].className)) { matchedArray[matchedArray.length]=elementArray[i]; } } else if(elementArray[i].getAttribute(attribute) ==attributeValue) { matchedArray[matchedArray.length]=elementArray[i]; } } return matchedArray; } function attachEventListener(target,eventType,functionRef,capture) { if(typeof target.addEventListener!="undefined") { target.addEventListener(eventType,functionRef,capture); } else if(typeof target.attachEvent !="undefined") { target.attachEvent("on"+eventType,functionRef); } else{ eventType="on" +eventType; if(typeof target[eventType] == "function") { var oldListener=target[eventType]; target[eventType]=function(){ oldListener(); return functionRef(); }; } else{ target[eventType]=functionRef; } } } function getScrollingPosition() { var position=[0,0]; if(typeof window.pageYOffset !='undefined') { position=[window.pageXOffset,window.pageYOffset]; } else if(typeof document.documentElement.scrollTop !='undefined' && document.documentElement.scrollTop>0) { position=[document.documentElement.scrollLeft,document.documentElement.scrollTop]; } else if(typeof document.body.scrollTop !='undefined') { position=[document.body.scrollLeft,document.body.scrollTop]; } return position; } function getEventTarget(event) { var targetElement=null; if(typeof event.target !='undefined') { targetElement=event.target; } else{ targetElement=event.srcElement; } return targetElement; }