Créer une page d'accueil en multicolore et dégradé
Ce javascript paramétrable vous permet
de créer cet accueil muticolore
et complètement paramétrable
tailles - couleurs - liens
crédits : 
Le
code à insérer dans votre page entre les balises body :
<script language="JavaScript">
var browser = "unknown";
var version = 0;
if (navigator.userAgent.indexOf("Opera") >= 0)
browser = "opera";
else if (navigator.userAgent.indexOf("obot") >= 0)
browser = "robot";
else if (navigator.appName.indexOf("etscape") >= 0)
browser = "netscape";
else if (navigator.appName.indexOf("icrosoft") >= 0)
browser = "msie";
version = parseFloat(navigator.appVersion);
if (isNaN(version)) version = 0;
if ((browser == "msie")&&(version == 2)) version =
3;
var tohex = new Array(256);
var hex = "0123456789ABCDEF";
var count = 0;
for (x=0; x<16; x++) {
for (y=0; y<16; y++) {
tohex[count] = hex.charAt(x) + hex.charAt(y);
count++;
}
}
function
ColorCode(hexcode) {
if (hexcode.length == 7) {
this.r = parseInt(hexcode.substring(1,3),16);
this.g = parseInt(hexcode.substring(3,5),16);
this.b = parseInt(hexcode.substring(5,7),16);
}
else if (hexcode.length == 6) {
this.r = parseInt(hexcode.substring(0,2),16);
this.g = parseInt(hexcode.substring(2,4),16);
this.b = parseInt(hexcode.substring(4,6),16);
}
else {
this.r = this.g = this.b = 0;
alert("Error: ColorCode constructor failed");
}
if (isNaN(this.r)||isNaN(this.g)||isNaN(this.b))
alert("Error: ColorCode constructor failed");
}
function ColorList(hexcodes) {
var i = 0;
var c = 0;
this.codes = new Array(Math.round(hexcodes.length/7));
while (i < hexcodes.length) {
if (isNaN(parseInt(hexcodes.substring(i,i+6),16))) ++i;
else {
this.codes[c] = new ColorCode(hexcodes.substring(i,i+6));
i += 7;
++c;
}
}
this.len = c;
}
function interpolate (x1, y1, x3, y3, x2) {
if (x3 == x1) return y1
else return (x2-x1)*(y3-y1)/(x3-x1) + y1
}
function lowcolorindex (x, y, z) {
if (y == 1) return 0
else return Math.floor( (x*(z-1))/(y-1) )
}
function hicolorindex (x, y, z, low) {
if ( low*(y-1) == x*(z-1) ) return low
else if (y == 1) return 0
else return Math.floor( (x*(z-1))/(y-1) + 1 )
}
function gradient (thetext,thecolors) {
if (((browser == "netscape")||
(browser == "msie")||(browser
== "opera"))&&(version>=3.0)) {
var colors = new ColorList(thecolors);
var numcolors = colors.len;
var numchars = thetext.length;
var rr = 0;
var gg = 0;
var bb = 0;
var lci = 0;
var hci = 0;
for (i=0; i<numchars; ++i) {
lci = lowcolorindex(i, numchars, numcolors);
hci = hicolorindex(i, numchars, numcolors, lci);
rr = Math.round(interpolate( lci/(numcolors-1), colors.codes[lci].r,
hci/(numcolors-1), colors.codes[hci].r, i/(numchars-1)));
gg = Math.round(interpolate( lci/(numcolors-1), colors.codes[lci].g,
hci/(numcolors-1), colors.codes[hci].g, i/(numchars-1)));
bb = Math.round(interpolate( lci/(numcolors-1), colors.codes[lci].b,
hci/(numcolors-1), colors.codes[hci].b, i/(numchars-1)));
if (browser == "opera") {
rr = 255 - rr;
gg = 255 - gg;
bb = 255 - bb;
}
document.write(thetext.charAt(i).fontcolor(tohex[rr]+tohex[gg]+tohex[bb]));
}
}
else document.write(thetext);
}
</script>
<script language="JavaScript">
<!--
// Mettez ici les séquences de dégradés
gradient("Trucs et Astuces pour BLogs","FF0000
FFFF00 FF9900");
document.write('<B><BR><BR>');
gradient("Pour sites et Webmestres","00ff00
ffff00 ff9900");
document.write('<BR><BR><FONT size=+1>');
gradient("Blogs MSN et Live Com","00ff00
ffff00 ff9900");
document.write('<BR><BR><BR><FONT
size=+5>');
gradient("BIENVENUE SUR","FF9900
FFFF88 88FF88 ffcc00 ff9900 00ff00");
document.write('</FONT><BR><FONT
size=7>');
gradient("AIDE ASTUCES WEBLOG","00ff00
33cc33 FFff66 FFCC00 FFFF00 ff9900");
document.write("</FONT></B><BR><BR></FONT><BR><FONT
size=5>");
gradient("Le site de FRANC83","FF0000
FFFF00 FF9900");
document.write('<B><BR><BR>');
gradient("Posez vos questions sur le forum
","FF9900 ffff00 FF9900");
document.write('<BR><BR><FONT size=+1>');
gradient("Il est maintenant libre d'accès
","FF9900 ffff00 FF9900");
document.write('<BR><BR><FONT size=+1>');
// -->
</script>
|
Changez
ces valeurs en hexa pour modifier les couleurs du texte
Changer
ces valeurs pour modifier les tailles de caractères
Changer
ces valeurs pour modifier le texte
En faisant des
copier/coller des lignes groupées gradient/document.write, vous pouvez
ajouter ou retirer des lignes à votre bloc de textes
Citez cet article
|
- Les messages comportant des attaques verbales contre les personnes seront supprimés.
- Vous pouvez renouveler le code de sécurité en appliquant un rafraîchissement à votre navigateur.
- Appliquer cette méthode de rafraîchissement si vous avez entré un mauvais code de sécurité.
|
Powered by AkoComment Tweaked Special Edition v.1.4.6 AkoComment © Copyright 2004 by Arthur Konze - www.mamboportal.com All right reserved |