»
EnglishFrenchVietnamese

Print - Text Fader 1.0 - JavaScriptBank.com

Full version: jsB@nk » Text » Fade-Glow » Text Fader 1.0
URL: https://www.javascriptbank.com/text-fader-1.html

Text Fader 1.0 © JavaScriptBank.comText Fader is a dhtml script that fades a block of text from one color to another. This gives a page a movie sort of introduction depending on its implentation. This can also be used as a fading headline news.

Full version: jsB@nk » Text » Fade-Glow » Text Fader 1.0
URL: https://www.javascriptbank.com/text-fader-1.html



CSS
<style type="text/css">        #Last { position: absolute; visibility: visible; z-index: 10; top:50px;left:120px }        A:link { color: red; text-decoration: none }        A:visited { color: red; text-decoration: none }        .BigLet { font: 30pt Times }        .smallLet { font: 16pt Times }        .small { font: 20pt Times }    </style><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


JavaScript
<script type="text/javascript" language="javascript 1.2">          ie4 = ((navigator.appName == "Microsoft Internet Explorer") &&(parseInt(navigator.appVersion) >= 4 ))          ns4 = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4 ))          if (ns4) {            layerRef="document.layers";            styleRef="";          } else {            layerRef="document.all";            styleRef=".style";          }/* <whew> After 2 days of researching and parsing the codes of others i finally was able to make a text fade-in/out script <g> Unfortunately, this can only do 3 colors, Red, Green and Blue. But don't worry, I'm working on it so that it'll work with any color and background. And do excuse the extra codes... this is my first script. Anyway, feel free to use the script but do pls include this little copyright... Emmanuel C. Halos - agent_teg@ThePentagon.com Copyright 1997 script created : 23 December 1997 "What a Cold Christmas this is going to be...." btw, the script works for IE4 and NS4 :) */          var convert = new Array();          var hexbase = new Array("0", "1", "2", "3", "4", "5", "6", "7",                                   "8", "9", "A", "B", "C", "D", "E", "F");          var value=0;          var rgb;          for (x=0; x<16; x++) {                for (y=0; y<16; y++) {                        convert[value] = hexbase[x] + hexbase[y];                        value++;                }           }          function changeContent(wColor,message) {            rgb = "#"+convert[wColor]+"0000";            if (ns4) {                eval(layerRef + '["Last"]' + styleRef + '.document.write("<font color="+rgb+">"+message+"</font>")');                eval(layerRef + '["Last"]' + styleRef + '.document.close()');            } else {                eval('Last.innerHTML="<font color="+rgb+">"+message+"</font>"');            }          }          function Fade(wColor, inout, speed, textDisp, topx, leftx) {            if (ns4) {                    eval(layerRef + '["Last"]' + styleRef + '.top = topx');                     eval(layerRef + '["Last"]' + styleRef + '.left = leftx');             } else {                    eval(layerRef + '["Last"]' + styleRef + '.posTop = topx')                    eval(layerRef + '["Last"]' + styleRef + '.posLeft = leftx');            }            if (inout == 1) {                if (wColor < 255) {                  wColor+=speed;                  if (wColor > 255) wColor=255;                   changeContent(wColor, textDisp);                 setTimeout("Fade("+wColor+","+inout+","+speed+",'"+textDisp+"',"+topx+","+leftx+")",0);                }            } else {                if (wColor > 0) {                  wColor-=speed;                  if (wColor < 0) wColor=0;                  changeContent(wColor, textDisp);                 setTimeout("Fade("+wColor+","+inout+","+speed+",'"+textDisp+"',"+topx+","+leftx+")",0);                }             }          }/* * Statement : Fade("Last", initialvalue [0-255], fade[fadein=1,fadeout=0], speed, textDisp string); */        function introduction() {          Fade(255, 0, 4, '<span class=BigLet>T</span><span class=small>his is the fade script</span><span class=BigLet>T</span><span class=small>EXT FADE 1.0</span>', 50, 150);          setTimeout("Fade(0, 1, 4, '<span class=small>which works in IE4 and NS4</span>', 170, 120)",700);          setTimeout("Fade(255, 0, 4, '<span class=small>IE4 gave me one heck of a time</span>', 120, 170)",1000);          setTimeout("Fade(0, 1, 4, '<span class=small>in trying to make it work with that browser</span>', 70, 100)",1000);          setTimeout("Fade(255, 0, 4, '<span class=small>Author: <a href=http://www2.mozcom.com/~halos>Teg</a></span>', 170, 90)",1000);          setTimeout("Fade(0, 1, 4, '<span class=small>Author Email <a href=mailto:agent_teg@ThePentagon.com>agent_teg@ThePentagon.com</a></span>', 170, 50)",1000);        }</script><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


HTML
<body onload="introduction()"><div id="Last"></div></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->