86、图片显隐的简单方法

86、图片显隐的简单方法

脚本说明:

把如下代码加入<body>区域中

<script>

var speed = 50;        //速度

var max_opacity = 100;  //最大

var min_opacity = 10;    //最小

var do_step  =  5;      //变化的幅度

 

       function change_opacity(obj,do_option)

       {

              if(obj.doing)

                     clearInterval(obj.doing);

              obj.doing = setInterval(do_option+"_alpha("+obj.sourceIndex+")",speed);      

       }

      

 

       function down_alpha(obj_index)

       {

              var obj = document.all[obj_index];

             

              if(obj.filters.Alpha.Opacity > min_opacity )

              {

                     obj.filters.Alpha.Opacity += -do_step;

              }    

              else

              {    

                     clearInterval(obj.doing);

                     obj.filters.Alpha.Opacity = min_opacity;

                     obj.doing = false;

              }    

       }    

       function up_alpha(obj_index)

       {

              var obj = document.all[obj_index];

             

              if(obj.filters.Alpha.Opacity<max_opacity)

                     obj.filters.Alpha.Opacity += do_step;

              else

              {    

                     clearInterval(obj.doing);

                     obj.filters.Alpha.Opacity = max_opacity;

                     obj.doing = false;

              }    

       }

      

</script>

<img  src="200206041.jpg" style="filter:Alpha(Opacity=10)" onmouseover="change_opacity(this,'up')" onmouseout="change_opacity(this,'down')" width="160" height="120">

<img  src="200206042.jpg" style="filter:Alpha(Opacity=10)" onmouseover="change_opacity(this,'up')" onmouseout="change_opacity(this,'down')" width="160" height="120">      

<img  src="200206043.jpg" style="filter:Alpha(Opacity=10)" onmouseover="change_opacity(this,'up')" onmouseout="change_opacity(this,'down')" width="160" height="120">      

<img  src="200206044.jpg" style="filter:Alpha(Opacity=10)" onmouseover="change_opacity(this,'up')" onmouseout="change_opacity(this,'down')" width="160" height="120">      

<img  src="200206045.jpg" style="filter:Alpha(Opacity=10)" onmouseover="change_opacity(this,'up')" onmouseout="change_opacity(this,'down')" width="160" height="120">  

Write a comment

Comments: 0