Vous ne trouvez pas de réponse à votre problème ? Alors posez la question dans le forum. Souvenez-vous qu'il n'y a jamais de question bête, mais rester dans l'ignorance parce que l'on n'ose pas poser une question, ça c'est une erreur !

NEWS TICKER LETTRE PAR LETTRE


Information sur la source

Catégorie :Effets Niveau : Débutant Date de création : 08/04/2005 Date de mise à jour : 14/03/2006 09:52:48 Vu : 5 163

Note :
8,33 / 10 - par 3 personnes
8,33 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10

Commentaire sur cette source (10)
Ajouter un commentaire et/ou une note

Description

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

  • <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>
<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)
 

Historique

09 avril 2005 18:09:01 :
Correction de bug
14 mars 2006 09:52:48 :
ajout de CRASHTEST dans les crédits , c'est lui qui mérite tout le respect au fond ...

Commentaires et avis

signaler à un administrateur
Commentaire de thibault31 le 08/04/2005 03:21:33

Correction de ton code Kevin pour intégrer la gestion des classes CSS, sinon il ne marche pas en l'état !
Pour ceux qui utilisent des styles sur leur site, çà évitera de vous foutre le bazard dans l'affichage !

Cordialement,
Thibault

<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


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(/&quot;/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 :&nbsp;</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 :&nbsp;";

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>

signaler à un administrateur
Commentaire de crashtest le 08/04/2005 11:32:15

Lu,
aucun de vos script ne marche.
Je l'ai réparé et maintenan il marche sous IE et sous firefox.

<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


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(/&quot;/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 :&nbsp;</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 :&nbsp;";

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>

signaler à un administrateur
Commentaire de jjdagadir le 09/04/2005 10:19:55

BEN OUI - 10 POUR CRASHTEST, C'EST LE SEUL CODE QUI FONCTIONNE !!!

signaler à un administrateur
Commentaire de kegi le 09/04/2005 19:03:02

merci crashtest,
jai unpdater mon code.

cordialement,
kevin (kegi@hotmail.com)

signaler à un administrateur
Commentaire de Romain128 le 12/04/2005 15:34:35

12/10.
(Comment ca "on peut pas"?)
Bon ben 10 alors...

signaler à un administrateur
Commentaire de sergio297 le 27/07/2005 12:12:13

Ton code est tooooop! C'est exactement ce que je cherchais.
Merci crashtest :)

signaler à un administrateur
Commentaire de kegi le 27/01/2006 04:54:59

Pour répondre à une question qu'on m'a posé: "Comment changer le target ?" voici la réponse:

rajouter simplement:
theAnchorObject.target = "_blank"; //le nom de votre frame :)

après la ligne:
theAnchorObject.href = theTargetLink;

Cordialement,
Kevin (kegi@hotmail.com)

signaler à un administrateur
Commentaire de norbertus le 10/03/2006 12:43:42

Super, mais comment le démarrer?
Le "pas de news pour le moment" reste toujours la...
(je sais, je débutte en java...)

Merci,

Norbert

signaler à un administrateur
Commentaire de kegi le 14/03/2006 09:49:48

C'est du JAVASCRIPT :P pas du JAVA

et la réponse (trop simple) se trouve sur ta boite de réception.

Cordialement,
Kevin (kegi@hotmail.com)

signaler à un administrateur
Commentaire de younes371 le 18/09/2006 18:32:44

Bonjour,
Je travail sur un projet,oû je dois mettre des onglets automatique, => vous m avez pa compris!! ??.
Alors j explique :
L'utilisateur lui meme peut créer ces onglet personnel.
Pour bien me comprendre, je vous demande d aller voir ce site : www.netvibes.com.
Si vous pouvez m'aider a trouver le script ou on le developpe ensemble ça serait gentil de votre part . Merci

Ajouter un commentaire



Nos sponsors

Sondage...

CalendriCode

Novembre 2008
LMMJVSD
     12
3456789
10111213141516
17181920212223
24252627282930

Consulter la suite du CalendriCode

Appels d'offres



Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel BAÏSE, Merci à Vincent pour ses précieux conseils
CodeS-SourceS.com© Toute reproduction même partielle est interdite sauf accord écrit du Webmaster
CodeS-SourceS.com© est une marque déposée tous droits réservés
Temps d'éxécution de la page : 0,749 sec

Google Coop CodeS-SourceS Google Coop CodeS-SourceS


Certaines images présentes sur le site (notament certains avatars) sont issues des collections IconShock, donc si vous souhaitez utiliser ces icons vous devez les acheter, ne les copiez pas et ne utilisez pas dans vos sites et applications sans les avoir commandé.