News ticker lettre par lettre


Contenu du snippet

Suite à une demande sur un forum, je vous offre un news ticker lettre par lettre que j'ai prit sur le site http://news.bbc.co.uk et que j'ai ajuster pour vous.

Source / Exemple :


<html>
<title></title>

<head>

<STYLE>
a.tickl{font-family:Verdana,Arial,Helvetica,sans-serif;font-size:11px;line-height:12px;text-decoration:none;color:#004477;font-weight:bold;}
a.tickl:hover{color:#C2262A;text-decoration:none;font-weight:bold;}
a.tickl:link{color:#004477;text-decoration:none;font-weight:bold;}
a.tickl:visited{color:#004477;text-decoration:none;font-weight:bold;}
.ticki{width:620px;height:30px;overflow:hidden;}
.ticko{width:620px;padding:1px 0 4px 0;margin:4px 0 0px 0;display:block;}
.tickls{
color:#C2262A;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
</STYLE>

<script language="JavaScript" type="text/javascript">
<!--

// ce script provient de http://news.bbc.co.uk
// adapté par kevin gilbert
// kegi@hotmail.com

////////////////////////////////////////////////////
// Le tout à été rabâtit par CRASHTEST , Merci ;) //
////////////////////////////////////////////////////

function startTicker()
{
// Define run time values
theCurrentStory     = -1;
theCurrentLength    = 0;
// Locate base objects
if (document.getElementById) {
    theAnchorObject     = document.getElementById("tickerAnchor");
runTheTicker();
}
else {
            document.write("<style>.ticki{display:none;}.ticko{border:0px; padding:0px;}</style>");
            return true;
}
}
// Ticker main run loop
function runTheTicker()
{
var myTimeout;
// Go for the next story data block
if(theCurrentLength == 0)
{
theCurrentStory++;
theCurrentStory      = theCurrentStory % theItemCount;
theStorySummary      = theSummaries[theCurrentStory].replace(/"/g,'"');
theTargetLink        = theSiteLinks[theCurrentStory];
theAnchorObject.href = theTargetLink;
thePrefix      = "<span class=\"tickls\">" + theLeadString + "</span>";
}
// Stuff the current ticker text into the anchor
theAnchorObject.innerHTML = thePrefix +
theStorySummary.substring(0,theCurrentLength) + whatWidget();
// Modify the length for the substring and define the timer
if(theCurrentLength != theStorySummary.length)
{
theCurrentLength++;
myTimeout = theCharacterTimeout;
}
else
{
theCurrentLength = 0;
myTimeout = theStoryTimeout;
}
// Call up the next cycle of the ticker
setTimeout("runTheTicker()", myTimeout);
}
// Widget generator
function whatWidget()
{
if(theCurrentLength == theStorySummary.length)
{
return theWidgetNone;
}

if((theCurrentLength % 2) == 1)
{
return theWidgetOne;
}
else
{
return theWidgetTwo;
}
}
// -->
</script>
</head>

<body>

<div class="ticki">
<a id="tickerAnchor" href="http://domusvitae.free.fr" target="_top" class="tickl">
<span class="tickls">NEWS : </span>pas de news pour le moment...</a>
</div>

  <script language="JavaScript" type="text/javascript">
<!--

var theCharacterTimeout = 50;
var theStoryTimeout     = 5000;
var theWidgetOne        = "_";
var theWidgetTwo        = "-";
var theWidgetNone       = "";
var theLeadString       = "NEWS : ";

var theSummaries = new Array();
var theSiteLinks = new Array();

var theItemCount = 4;

// ici, vous metez vos texte et vos description mais n'oubliez pas de changer la
// variable theItemCount pour indiquer le nombre de news

    theSummaries[0] = "Ici, je met mon premier texte qui est un lien vers Mon site de rencontre ;)";
    theSiteLinks[0] = "http://kegi1.ekzay.com/rw-3/";

    theSummaries[1] = "Ici je met mon deuxième texte qui est un lien vers google.com";
    theSiteLinks[1] = "http://www.google.com";

    theSummaries[2] = "etc...";
    theSiteLinks[2] = "http://www.perdu.com";

    theSummaries[3] = "etc...";
    theSiteLinks[3] = "http://www.perdu.com";

  startTicker();

  //-->
  </script>

</body>
</html>

Conclusion :


Maintenant, poster vos commentaires ;)

cordialement,
kevin (kegi@hotmail.com)

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.