上下滚动效果
function flaotLR(obj){
this.idObj=document.getElementById(obj.id);
this.x=obj.x;
this.y=obj.y;
this.time=obj.time||60;
this.In;
this.TF=true;
var myself=this;
this.init();
this.idObj.onmouseover=function(){myself.clearIn();}
this.idObj.onmouseout=function(){myself.setIn();}
}
flaotLR.prototype={
getWH:function(){
var wh={width:(document.body.clientWidth)-this.idObj.offsetWidth,
height:(document.all?document.getElementsByTagName("html")[0].offsetHeight:window.innerHeight)-this.idObj.offsetHeight}
return wh;
},
setPosition:function(x,y){
if(x<0){this.idObj.style.left=this.getWH().width+x+"px";}
else {this.idObj.style.left=x+document.body.scrollLeft+"px";}
this.idObj.style.top=y+document.body.scrollTop+"px";
},
panduan:function(){
with(this){
y=y+(TF?1:-1);
y>getWH().height&&(y=getWH().height,TF=false)
y<0&&(y=0,TF=true)
}
},
setIn:function(){
var me=this;
this.In=setInterval(function(){me.panduan();me.setPosition(me.x,me.y);},this.time);
},
clearIn:function(){
var me=this;
clearInterval(me.In)
},
init:function(){
this.setIn();
}
}