126、图片的明暗变化

126、图片的明暗变化

脚本说明:

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

<script>

function hover(id,opacity){

       document.all[id].filters.alpha.opacity = opacity;

}

 

function opacify(id,delay,start,stop){

    opacify(id,delay,start,stop,0);

    }

   

function opacify(id,delay,start,stop,offset){

    offset *= 1000;

    if (document.all){

        hover(id,start);

        setTimeout("fadeOut('"+id +"',"+ delay +","+ start +","+stop +")",offset);

        }

    }   

 

function fadeOut(id,delay,start,stop){

    if (document.all[id].filters.alpha.opacity > stop){

        document.all[id].filters.alpha.opacity -= 2;

        setTimeout("fadeOut('"+ id +"',"+ delay +","+ start +","+ stop +")",delay);

        }

    else {

        setTimeout("fadeIn('"+ id +"',"+ delay +","+ start +","+ stop +")",delay);

        }

    }  

   

function fadeIn(id,delay,start,stop){

    if (document.all[id].filters.alpha.opacity < start){

        document.all[id].filters.alpha.opacity += 2;

        setTimeout("fadeIn('"+ id +"',"+ delay +","+ start +","+ stop +")",delay);

        }

    else {

        setTimeout("fadeOut('"+ id +"',"+ delay +","+ start +","+ stop +")",delay);

        }

    }     

   

 

</script>

<img src="anarchos_button.jpg" name="imageName" onLoad="opacify('imageName',22,100,20)" style="filter:alpha(opacity=100);" alt="blah" />

 

 

 

Write a comment

Comments: 0