欢迎来到福编程网,本站提供各种互联网专业知识!

用JTrackBar实现的模拟苹果风格的滚动条

发布时间:2007-08-06 作者: 来源:转载
复制代码代码如下:functionJObj(){}JObj.$c=function(tag){returndocument.createElement(tag)};JObj.$=function(id){returndocument.getElementById(id)};JObj.isRate=function(pRateString){if(!isNaN(pRateString))returnfalse;if(pRateString.substr(

复制代码 代码如下:
functionJObj(){}
JObj.$c=function(tag){returndocument.createElement(tag)};
JObj.$=function(id){returndocument.getElementById(id)};
JObj.isRate=function(pRateString){
if(!isNaN(pRateString))returnfalse;
if(pRateString.substr(pRateString.length-1,1)!="%")
returnfalse;
if(isNaN(pRateString.substring(0,pRateString.length-1)))
returnfalse;
returntrue;
}

functionJPos(){}
JPos.getAbsPos=function(pTarget){
varx_=y_=0;
while(pTarget.offsetParent){
x_+=pTarget.offsetLeft;
y_+=pTarget.offsetTop;
pTarget=pTarget.offsetParent;
}
x_+=pTarget.offsetLeft;
y_+=pTarget.offsetTop;
return{x:x_,y:y_};
}

JPos.getMousePos=function(evt){
varx_=y_=0;
evt=evt||window.event;
if(evt.pageX||evt.pageY){
x_=evt.pageX;
y_=evt.pageY;
}else{
x_=evt.clientX+document.body.scrollLeft-document.body.clientLeft;
y_=evt.clientY+document.body.scrollTop-document.body.clientTop;
}

return{x:x_,y:y_};
}

相关推荐