漂浮广告(从上往下飘最后消失)

代码
   <script type="text/javascript"> 
        
            
var adtime = 100;   //时间
            var adheight =0;    //高度
            
            $(document).ready(
function(){
                addCount(); 
                adtime
=300;
                setTimeout(
"noneAds()",7000); //停留时间
            })
 
            
function addCount() 
            { 
                
if(adtime>0) { 
                    adtime
--
                    adheight 
= adheight+5
                }
else { 
                    
return
                } 
                
if(adheight>415)  //高度 
                { 
                    
return
                } 
                document.getElementById(
"ad01").style.display = ""
                document.getElementById(
"ad01").style.height = adheight+"px"
                setTimeout(
"addCount()",30); 
            } 
            
var N = 415//高度 
            function noneAds() { 
                
if(adtime>0){ 
                    adtime
--
                    N 
= N-5
                }
else { 
                    
return
                } 
                
if(N<0){ 
                    document.getElementById(
"ad01").style.display = "none"
                    
return
                } 
                document.getElementById(
"ad01").style.height = N+"px"
                setTimeout(
"noneAds()",30); 
            } 
        
</script> 
原文地址:https://www.cnblogs.com/fanxianhua/p/1650665.html