非接触位移测量的直线位移传感器

2012-08-02 09:42:03   来源:21ic   

关键字: 位移测量  位移传感器  微脉冲

|| window.event; var mousePos = mouseCoords(ev); xpos = mousePos.x; ypos = mousePos.y; } function mouseCoords(ev) { if(ev.pageX || ev.pageY){ return {x:ev.pageX, y:ev.pageY}; } return { x:ev.clientX + document.documentElement.scrollLeft - document.documentElement.clientLeft, y:ev.clientY + document.documentElement.scrollTop - document.documentElement.clientTop }; } function getPos(elem) { var offsetY=elem.offsetTop; var offsetX=elem.offsetLeft; while(elem.offsetParent!=null) { elem = elem.offsetParent; offsetY+=elem.offsetTop; offsetX+=elem.offsetLeft; } return [offsetX,offsetY]; } /* display company keywords. */ var companyAdEvent = {}; companyAdEvent.firstShow = true; companyAdEvent.show = function(ele,recId,offset){ //var eP = companyAdEvent.getPosition(ele); if(!offset) offset = [0,0]; clearTimeout(this.outEvent); if (this.firstShow) { var pos = getPos(ele); xpos = pos[0]; ypos = pos[1]; this.firstShow = false; this.outEvent = setTimeout(function(){ $(recId).style.display="none"; },3000); } $(recId).setStyle({ "left":(xpos+offset[0])+"px", "top":(ypos+offset[1])+"px", display:"block" }); xpos = 0; ypos = 0; } companyAdEvent.getPosition = function(tag){ var Position = [0,0]; while (tag) { tn = tag.tagName.toUpperCase(); Position[0] += tag.offsetLeft; Position[1] += tag.offsetTop; if(tn == "BODY") break; tag = tag.offsetParent; } return Position; } companyAdEvent.showCompanyAd = function(){ clearTimeout(this.outEvent); } companyAdEvent.out = function(recId){ companyAdEvent.outEvent = setTimeout(function(){ $(recId).setStyle({ display:"none" }); },100); } //-->