»
EnglishFrenchVietnamese

Print - Fade Function script - JavaScriptBank.com

Full version: jsB@nk » Snippet » Fade Function script
URL: http://www.javascriptbank.com/fade-function-script.html

Fade Function script © JavaScriptBank.comThis script creates a JavaScript function that fades HTML elements in or out. This script creates a JavaScript function to fade any HTML element in or out at a specified time frame. This could have any number of uses and is completely re-useable throughout your Web page. Use this function on as many elements as you want.

Full version: jsB@nk » Snippet » Fade Function script
URL: http://www.javascriptbank.com/fade-function-script.html



JavaScript
<SCRIPT>   var WAVSCRIPT_FADENUMBER=0    function fade(){    if(navigator.appName=="Microsoft Internet Explorer")    {    var WAVSCRIPT_DOMCHANGESTYLE="filter='alpha(opacity='+WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER+"+')'"    }    else    {    var WAVSCRIPT_DOMCHANGESTYLE="opacity=0+'.'+WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER    }   if(arguments[2]=="in")   {   document.write("<scr"+"ipt>var WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER+"=10;function WAVSCRIPT_FADEFUNCTION"+WAVSCRIPT_FADENUMBER+"(){document.getElementById('"+arguments[0]+"').style."+WAVSCRIPT_DOMCHANGESTYLE+";WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER+"++;timer"+WAVSCRIPT_FADENUMBER+"=setTimeout('WAVSCRIPT_FADEFUNCTION"+WAVSCRIPT_FADENUMBER+"()',"+arguments[1]+");if(WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER+"==99){clearTimeout(timer"+WAVSCRIPT_FADENUMBER+")}else{}}WAVSCRIPT_FADEFUNCTION"+WAVSCRIPT_FADENUMBER+"()</scr"+"ipt>")   }   else   {   document.write("<scr"+"ipt>var WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER+"=99;function WAVSCRIPT_FADEFUNCTION"+WAVSCRIPT_FADENUMBER+"(){document.getElementById('"+arguments[0]+"').style."+WAVSCRIPT_DOMCHANGESTYLE+";WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER+"--;timer"+WAVSCRIPT_FADENUMBER+"=setTimeout('WAVSCRIPT_FADEFUNCTION"+WAVSCRIPT_FADENUMBER+"()',"+arguments[1]+");if(WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER+"==10){WAVSCRIPT_FADEINCRIMENTVARIABLE"+WAVSCRIPT_FADENUMBER+"=0;document.getElementById('"+arguments[0]+"').style."+WAVSCRIPT_DOMCHANGESTYLE+";clearTimeout(timer"+WAVSCRIPT_FADENUMBER+");}else{}}WAVSCRIPT_FADEFUNCTION"+WAVSCRIPT_FADENUMBER+"()</scr"+"ipt>")   }  WAVSCRIPT_FADENUMBER++  }  </SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<DIV id=t1 style="WIDTH: 100%">element 1 fades in at 100 89 milisecond increments</DIV><DIV id=t2 style="WIDTH: 100%">element 2 fades out at 50 89 milisecond increments</DIV><DIV id=t3 style="WIDTH: 100%">element 3 fades out at 20 89 milisecond increments</DIV><DIV id=t4 style="WIDTH: 100%">element 4 fades in at 20 89 milisecond increments</DIV><SCRIPT>   fade("t1",100,"in")   fade("t2",50,"out")   fade("t3",20,"out")   fade("t4",20,"in")  </SCRIPT><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->