Un lien digital clignotant.

DEMONSTRATION

C'est peut être un peu lourd avec les images (~8Ko), mais c'est sympa.


Code source en 2 parties

Entre <HEAD> et <HEAD>
top

<SCRIPT LANGUAGE="JavaScript">
<!--
//D'autres script,applet,images sur webgraf.Com 
//Mathieu Gros, webmaster@webgraf.Com
AvailableChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789âàçêèéïôù'@ !?.:/-,_~";
caracteres = new Array();
for ( var i = 0; i < 83; i++) {
filename = "font/c" + i + ".gif";
caracteres[i] = new Image();
caracteres[i].src = filename;
}
for ( var i = 100; i < 157; i++) {
filename = "font/c" + i + ".gif";
caracteres[i] = new Image();
caracteres[i].src = filename;
}
function LedBlink(Texte,LeLien,LedSize,Vitesse,Fonction) {
this.BlinkTexte = " " + Texte + " ";	
this.BlinkSpeed= Vitesse;			
this.Font = LedSize;
this.fonction = Fonction + '.Blink()';	
this.Size = this.BlinkTexte.length;		
this.Lien = LeLien;
this.timeout = null;
this.basename = Fonction;
this.show = true;					
this.datas = new Array(this.Size);
this.decalage = 0;
this.Init = Initialise;
this.Draw = DrawBoard;
this.GoUrl = Go;
this.Blink = TheBlink;
this.SetMessage = SetMsg;
this.SetSpeed = SetSpd;
this.SetLink = SetLnk;
this.Stop = StopAll;
this.Draw();
this.Init();
this.Blink();
}
function DrawBoard() {
document.write('<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0>');
document.write('<TR>');
if (this.Font == "small") {
this.decalage = 74;
for (var x = 0; x < this.Size; x++) {
document.write('<TD WIDTH=10 HEIGHT=17><A HREF="" TARGET="_self" onClick="this.href='+this.basename+'.GoUrl();"><IMG SRC="font/c147.gif" WIDTH=11 HEIGHT=17 BORDER=0 NAME="'+this.basename+x+'"></A></TD>');
}
}
else {
this.decalage = 0;
for (var x = 0; x < this.Size; x++) {
document.write('<TD WIDTH=12 HEIGHT=23><A HREF="" TARGET="_self" onClick="this.href='+this.basename+'.GoUrl();"><IMG SRC="font/c73.gif" WIDTH=13 HEIGHT=23 BORDER=0 NAME="'+this.basename+x+'"></A></TD>');
}
}
document.write('</TR>');
document.write('</TABLE>');
}
function Initialise() {
if (this.Font == "small") {
this.BlinkTexte = this.BlinkTexte.toUpperCase();
}
for (var x = 0; x < this.Size; x++) {
this.datas[x] = caracteres[AvailableChars.indexOf(this.BlinkTexte.charAt(x)) + this.decalage];
}
}
function TheBlink() {
if (this.show) {
for (var x = 0; x < this.Size; x++) {
document.images[this.basename+x].src = this.datas[x].src;
}
}
else {
for (var x = 0; x < this.Size; x++) {
document.images[this.basename+x].src =caracteres[73+this.decalage].src;
}
}
this.show = !this.show;
this.timeout = window.setTimeout(this.fonction,this.BlinkSpeed);
}
function Go() {
return  this.Lien;
}
function SetMsg(NewMsg) {
if (NewMsg.length <= this.Size) {
f1 = Math.floor((this.Size - NewMsg.length) / 2);
f2 = Math.floor( ( (this.Size - NewMsg.length) / 2) + ( (this.Size - NewMsg.length) % 2) );
for (var i = 0; i < f1; i++) {
NewMsg = " " + NewMsg;
}
for (var i = 0; i < f2; i++) {
NewMsg = NewMsg + " ";
}
this.BlinkTexte = NewMsg;
this.Init();
}
}
function SetSpd(NewSpd) {
this.BlinkSpeed = NewSpd;
}
function SetLnk(NewLnk) {
this.Lien = NewLnk;
}
function StopAll() {
clearTimeout(this.timeout);
this.timeout = null;
}
//-->
</SCRIPT>
 
Dans le corp du document (entre <body> et </body>):
top

<SCRIPT LANGUAGE="JavaScript">
<!--
LeBlink = new LedBlink("METTEZ VOTRE TEXTE ICI","votre-lien-ici.html","normal",200,"LeBlink");
//Explication:   ("  texte  "," URL "," normal ou small ",vitesse,"LeBlink")
//-->
</SCRIPT>
 
INFORMATIONS COMPLEMENTAIRES
top

Comment intégrer ce script dans votre page: Vous pouvez télécharger cette page (avec toutes les images ) au format zip :télécharger.








Un problème ou une critique : e-mail
Des ressources utiles et gratuites pour vos pages Web :
webgraf.com