本文實例講述了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程式設計有所幫助。