Site hosted by Angelfire.com: Build your free website today!

Dégradé de couleur

DANS LA PARTIE <HEAD>

<SCRIPT LANGUAGE="JavaScript">
        <!--
        // Copyrights
        // web : http://www.weboutils.com
        // e-mail : weboutils@wanadoo.fr
        // Ce script est librement utilisable. Merci de ne pas effacer ces commentaires.
       
        var hexa = "0123465789ABCDEF";
       
        function DecToHexa(DecNb) {
            x = Math.floor(DecNb / 16);
            h = hexa.charAt(x);
            x = DecNb % 16;
            h += hexa.charAt(x);
       
            return h;
        }
       
        function Degrade(dr,dg,db,fr,fg,fb,texte) {
            steps = texte.length;
            cr = dr; cg = dg; cb = db;
            sr = (fr - dr) / steps;
            sg = (fg - dg) / steps;
            sb = (fb - db) / steps;
           
            for (var x = 0; x <= steps; x++) {
                document.write('<FONT COLOR="#' + DecToHexa(cr) + DecToHexa(cg) + DecToHexa(cb) + '">');
                document.write(texte.charAt(x));
                document.write('</FONT>');
                cr += sr; cg += sg; cb += sb;
            }
        }
        //-->
    </SCRIPT>

DANS LA PARTIE <BODY>

<SCRIPT LANGUAGE = "JavaScript">
Degrade(255,255,0,0,255,255,"Voici le texte et son dégradé de couleurs !");
</SCRIPT>