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

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′);

Leave a Reply