本文实例讲述了JS实现仿中关村论坛评分后弹出提示效果的方法。分享给大家供大家参考。具体实现方法如下: 复制代码 代码如下: JS仿中关村论坛评分后弹出提示的效果 <br /> var x=window.x||{};<br /> x.creat=function(t,b,c,d){<br /> this.t=t;<br /> this.b=b;<br /> this.c=c;<br /> this.d=d;<br /> this.op=1;<br /> this.div=document.createElement("div");<br /> this.div.style.height="40px";<br /> this.div.style.width="100px";<br /> this.div.style.background="red";<br /> this.div.style.position="absolute";<br /> this.div.style.left="50%";<br /> this.div.style.marginLeft="-50px"<br /> this.div.style.marginTop="-20px"<br /> this.div.innerText="谢谢参与!经验+5"<br /> this.div.style.fontSize="12"<br /> this.div.style.lineHeight=this.div.style.height<br /> this.div.style.textAlign="center";<br /> this.div.style.fontWeight="bold"; <br /> //this.div.style.border="solid red 1px"; <br /> this.div.style.color="#fff"<br /> this.div.style.top=(this.b+"%");<br /> document.body.appendChild(this.div);<br /> this.run();<br /> }<br /> x.creat.prototype={<br /> run:function(){<br /> var me=this;<br /> this.div.style.top=-this.c*(this.t/this.d)*(this.t/this.d)+this.b+"%";<br /> this.t++;<br /> this.q=setTimeout(function(){me.run()},25)<br /> if(this.t==this.d){<br /> clearTimeout(me.q);<br /> setTimeout(function(){me.alpha();},1000);<br /> }<br /> },<br /> alpha:function(){<br /> var me=this;<br /> if("\v"=="v"){<br /> this.div.style.filter="progid:DXImageTransform.Microsoft.Alpha(opacity="+this.op*100+")";<br /> this.div.style.filter="alpha(opacity="+this.op*100+")";<br /> ;}<br /> else{this.div.style.opacity=this.op}<br /> this.op-=0.02;<br /> this.w=setTimeout(function(){me.alpha()},25)<br /> if(this.op<=0){<br /> clearTimeout(this.w);<br /> document.body.removeChild(me.div);<br /> }<br /> }<br /> }<br /> new x.creat(1,50,25,30);<br /> 希望本文所述对大家的javascript程序设计有所帮助。