Un lien digital en scrolling.

DEMONSTRATION

C'est peut un peu lourd avec les images (~8Ko), mais c'est toujours aussi 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 LedScroll(Texte,LeLien,LedSize,Taille,Vitesse,Fonction) {
this.ScrollTexte = "     " + Texte;		
this.Size = Taille;					
this.Font = LedSize;
this.scrollspeed = Vitesse;			
this.fonction = Fonction + '.Scroll()';	
this.along = this.ScrollTexte.length;	
this.Lien = LeLien;
this.timeout = null;
this.basename = Fonction;
this.datas = new Array(this.along);
this.decalage = 0;
this.Draw = DrawBoard;
this.Init = Initialise;
this.GoUrl = Go;
this.SetMessage = SetMsg;
this.SetSpeed = SetSpd;
this.SetLink = SetLnk;
this.Scroll = TheScroll;
this.Stop = StopAll;
this.Draw();
this.Init();
this.Scroll();
}
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.ScrollTexte = this.ScrollTexte.toUpperCase();
}
for (var x = 0; x < this.along; x++) {
this.datas[x] = caracteres[AvailableChars.indexOf(this.ScrollTexte.charAt(x)) + this.decalage];
}
}
function TheScroll() {
var dummy = this.datas[0];
for (var x = 0; x < (this.along - 1); x++) {
this.datas[x] = this.datas[x + 1];
}
this.datas[this.along-1] = dummy;
for (var x = 0; x < this.Size; x++) {
document.images[this.basename+x].src = this.datas[x].src;
}
this.timeout = window.setTimeout(this.fonction,this.scrollspeed);
}
function Go() {
return  this.Lien;
}
function SetMsg(NewMsg) {
NewMsg = "     " + NewMsg;
this.along = NewMsg.length;
this.datas = new Array(this.along);
this.ScrollTexte = NewMsg;
this.Init();
}
function SetSpd(NewSpd) {
this.scrollspeed = 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">
<!--
LeScroll = new LedScroll("CECI EST UN LIEN","mailto:webmaster@webgraf.com","normal",20,200,"LeScroll");
//Explication:   ("  texte  "," URL "," normal ou small ",longeur,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