Posts Tagged ‘滚动’

今天写的一个练习的js类模式

Posted in 默认分类 on 六月 10th, 2009 by admin – Be the first to comment
suspendcode="
’关闭对联广告’
" document.write(suspendcode); var hp = { lastScrollY : 0, byID : function(_id){ return document.getElementById(_id);}, init : function(id){ var st = document.documentElement.scrollTop || document.body.scrollTop; percent=.1*(st-this.lastScrollY); if(percent>0){ percent=Math.ceil(percent); }else{ percent=Math.floor(percent); } this.byID(id).style.top=parseInt(this.byID(id).style.top)+percent+"px"; this.lastScrollY=this.lastScrollY+percent; return id; }, generate : function(){ }, start : function(id){ window.setInterval("hp.init(’"+id+"’)",1); } }; #hp.start(’lovexin1′);