我的学习历程与笔记

博客园 首页 联系 订阅 管理
<html>
  
<head>
    
<title>dt filter</title>
    
<script language="javascript">
      
<!--
        var j
=0;
        var i 
= 100;
        var c 
= false;
        
// the array is used to store the picture
        names= new Array();
        names[
0]="F001.JPG";
        names[
1]="DSC01297.JPG";
        names[
2]="DSC08292.JPG";
        names[
3]="11.jpg";
        names[
4]="DSCF1670.JPG";
        var isIE 
= isIE();
        
//var isIE = true;
        function filter(){
            
if(document.all);
            
if(c == true) {
                i
++;
            }
            
if(i==100) {
                i
--;
                c 
= false
            }
            
if(i==1) {
                i
++;
                c 
= true;
                
//change the picture
                if(j==names.length-1){j=0;}
                    
else{++j;}
                
//alert(j);
                
//get the picture by the index of names array
                myimage.src=names[j];
            }
            
if(c == false) {
                i
--;
            }
            
             
//show or hide the picture by filter
            
//alert(isIE);
            if (isIE)
            {
                myimage.filters.alpha.opacity
=i;
            }
            
else
            {
                myimage.style.opacity 
= i/100;
            }
            setTimeout(
"filter()",50);
        }

    function isIE()
    {
        var ret 
= false
        
if (navigator.userAgent.indexOf("MSIE")>0)
        {
            ret 
=true;    
        }
        
return ret;
    }

      
-->
    
</script>
  
</head>

 
<body onload="filter()"><!--load the js function-->
      
<img id="myimage" src="F001.JPG" width="500" height="350"
        style
="filter:alpha();position:absolute;top:10;left:0;">
     
</body>
 
</html>
posted on 2009-09-04 10:15  super.jiang  阅读(377)  评论(0)    收藏  举报