begin process at 2012 05 28 10:59:18
  Trouver un code source :
 
dans
 
Accueil > 

Code

 > 

Graphique

 > LECTEUR DE NOUVELLES

LECTEUR DE NOUVELLES


 Information sur la source

Note :
9 / 10 - par 4 personnes
9,00 / 10

  • 1

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
Catégorie :Graphique Niveau :Débutant Date de création :22/07/2003 Date de mise à jour :22/07/2003 06:32:09 Vu :14 943

Auteur : francktfr

Ecrire un message privé
Site perso
Commentaire sur cette source (10)
Ajouter un commentaire et/ou une note

 Description

Cliquez pour voir la capture en taille normale
Ce code permet de faire défiler n'importe quel block
html, ca peut etre utilisé pour faire defiler l'actualité d'un site ...
La seule chose a faire, c'est de bien nommer les block :"news".

voila :o)

Source

  • <HTML>
  • <HEAD>
  • <TITLE></TITLE>
  • <SCRIPT>
  • function NewsInit(){
  • // positionnement du block mainnews
  • mainnews.style.left = NewsContent.offsetLeft + NewsReader.offsetLeft +4
  • mainnews.style.top = NewsContent.offsetTop + NewsReader.offsetTop
  • mainnews.style.width = NewsContent.offsetWidth -1
  • mainnews.style.height = NewsContent.offsetHeight - 1
  • ScrollNews()
  • }
  • var newsblock
  • var topinit = 150 // point de depart
  • var Index = 0 // index dans la collection de news
  • var OldIndex = 0 // index d'avant
  • var Top = topinit // valeur courante
  • var start = 1
  • function ScrollNews(){
  • if (Top == 4)
  • {
  • OldIndex = Index
  • Index >= (news.length-1) ? Index = 0 : Index++
  • Top = topinit
  • setTimeout("ScrollNews()",2000)
  • start=0
  • return false
  • }
  • if (Top == (topinit-1)) {news[OldIndex].style.top = topinit}
  • Top--
  • news[Index].style.top = Top
  • if (start==0){news[OldIndex].style.top = Top-146}
  • setTimeout("ScrollNews()",5)
  • }
  • </SCRIPT>
  • <STYLE>
  • .NewsBlock{display: block; position: absolute; top: 150; left: 0; font: 12 Arial; width:222; border: 1 solid black}
  • .NewsHead{color: black; background: #B5B5B5;}
  • .NewsContent{width:220; font: 12 Courier New; background: #F3F3F3; padding: 2 2 2 2;}
  • .NewReaderBlock{border: 1px solid black ; width: 232; height: 150;background: black; color: white; font: 14 Arial; text-align: center}
  • .NewReaderContent{height: 125; background: white}
  • .MainContent{border: none; position: absolute; left: 0; top: 0; width: 100; height: 100; clip: rect(0,222,125,0 ); background: transparent}
  • </STYLE>
  • </HEAD>
  • <BODY onload="NewsInit()">
  • <TABLE ID="NewsReader" CLASS="NewReaderBlock" CELLPADDING=0 CELLSPACING=0 ALIGN="center">
  • <TR><TD><B>. : : Les nouvelles neuves : : .</B></TD></TR>
  • <TR><TD ID="NewsContent" CLASS="NewReaderContent">&nbsp;</TD></TR>
  • </TABLE>
  • <DIV ID="mainnews" CLASS="MainContent">
  • <TABLE CLASS="NewsBlock" ID="news" CELLSPACING=0 CELLPADDING=1 BORDER=0>
  • <TR CLASS="NewsHead"><TD>Le but</TD></TR>
  • <TR><TD CLASS="NewsContent">Faire défiler<BR>toutes formes de balises HTML,<BR>tableaux et autres ...</TD></TR>
  • </TABLE>
  • <TABLE CLASS="NewsBlock" ID="news" CELLSPACING=0 CELLPADDING=1 BORDER=0>
  • <TR CLASS="NewsHead"><TD>Simplicité</TD></TR>
  • <TR><TD CLASS="NewsContent">Vous pouvez y mettre tout<BR>ce que vous voulez.</TD></TR>
  • </TABLE>
  • <TABLE CLASS="NewsBlock" ID="news" CELLSPACING=0 CELLPADDING=1 BORDER=0>
  • <TR CLASS="NewsHead"><TD>Autant que vous voulez</TD></TR>
  • <TR><TD CLASS="NewsContent">Et même un peu de pub ....<BR><A HREF="www.systeme-d.net" TARGET="_blank">Systeme D</A><BR>Mais non j'en profite pas ;o)</TD></TR>
  • </TABLE>
  • </DIV>
  • </BODY>
  • </HTML>
<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT>  
function NewsInit(){
	//	positionnement du block mainnews
	mainnews.style.left = NewsContent.offsetLeft + NewsReader.offsetLeft +4
	mainnews.style.top = NewsContent.offsetTop + NewsReader.offsetTop 
	mainnews.style.width = NewsContent.offsetWidth -1
	mainnews.style.height = NewsContent.offsetHeight - 1
	ScrollNews()
}
var newsblock
var topinit = 150	//	point de depart
var Index = 0	//	index dans la collection de news
var OldIndex = 0	//	index d'avant
var Top = topinit	//	valeur courante
var start = 1
function ScrollNews(){
	if (Top == 4)
		{
			OldIndex = Index
			Index >= (news.length-1) ? Index = 0 : Index++
			Top = topinit
			setTimeout("ScrollNews()",2000)
			start=0
			return false
		}
	if (Top == (topinit-1)) {news[OldIndex].style.top = topinit}
	Top--
	news[Index].style.top = Top
	if (start==0){news[OldIndex].style.top = Top-146}
	setTimeout("ScrollNews()",5)
}
</SCRIPT>
<STYLE>
.NewsBlock{display: block; position: absolute;  top: 150; left: 0; font: 12 Arial; width:222; border: 1 solid black}
.NewsHead{color: black; background: #B5B5B5;}
.NewsContent{width:220; font: 12 Courier New; background: #F3F3F3; padding: 2 2 2 2;}
.NewReaderBlock{border: 1px solid black ; width: 232; height: 150;background: black; color: white; font: 14 Arial; text-align: center}
.NewReaderContent{height: 125; background: white}
.MainContent{border: none; position: absolute; left: 0; top: 0; width: 100; height: 100; clip: rect(0,222,125,0 ); background: transparent}
</STYLE>
</HEAD>
<BODY onload="NewsInit()">

<TABLE ID="NewsReader" CLASS="NewReaderBlock" CELLPADDING=0 CELLSPACING=0 ALIGN="center">
  <TR><TD><B>. : : Les nouvelles neuves : : .</B></TD></TR>
  <TR><TD ID="NewsContent" CLASS="NewReaderContent">&nbsp;</TD></TR>
</TABLE>
<DIV ID="mainnews" CLASS="MainContent">

<TABLE CLASS="NewsBlock" ID="news" CELLSPACING=0 CELLPADDING=1 BORDER=0>
  	<TR CLASS="NewsHead"><TD>Le but</TD></TR>
  	<TR><TD CLASS="NewsContent">Faire défiler<BR>toutes formes de balises HTML,<BR>tableaux et autres ...</TD></TR>
</TABLE>
<TABLE CLASS="NewsBlock" ID="news" CELLSPACING=0 CELLPADDING=1 BORDER=0>
  	<TR CLASS="NewsHead"><TD>Simplicité</TD></TR>
  	<TR><TD CLASS="NewsContent">Vous pouvez y mettre tout<BR>ce que vous voulez.</TD></TR>
</TABLE>
<TABLE CLASS="NewsBlock" ID="news" CELLSPACING=0 CELLPADDING=1 BORDER=0>
  	<TR CLASS="NewsHead"><TD>Autant que vous voulez</TD></TR>
  	<TR><TD CLASS="NewsContent">Et même un peu de pub ....<BR><A HREF="www.systeme-d.net" TARGET="_blank">Systeme D</A><BR>Mais non j'en profite pas ;o)</TD></TR>
</TABLE>

</DIV>

</BODY>
</HTML>
 



 Sources du même auteur

Source avec une capture CHOIX DE DATES ET DE PERIODE
HORLOGE DIGITALE , SI SI
Source avec une capture TEXT COLORISÉ AVEC LE POURCENTAGE
Source avec une capture MENU AVEC EFFET DE DÉGRADÉ
ANNONCE LETTRE PAR LETTRE

 Sources de la même categorie

Source avec Zip JDMATH-MINI.JS : GÉNÉRATION D'EXPRESSION MATHÉMATIQUE par jdmcreator
Source avec une capture SPHERE 3D DÉFORMABLE par phm
Source avec Zip Source avec une capture EFFET DE ROTATION A 360° D'IMAGE AVEC ACCELERATION DECELERAT... par kazma
Source avec Zip Source avec une capture PETIT LOGICIEL DE DESSIN, RETOUCHE AVEC CANVAS par kazma
Source avec Zip Source avec une capture CALCULATRICE HEURE par m22001111

Commentaires et avis

Commentaire de bob3000 le 22/07/2003 19:50:41

excellent

Commentaire de phsautreau le 23/07/2003 08:42:03

Tout simplement : génial !

Bravo !

Commentaire de francktfr le 23/07/2003 10:13:54

Merci merci :o)

Commentaire de playerone27 le 16/01/2004 01:07:11

Si je met le script dans un tableau, il y a un décalage du contenu par rapport au cadre. Comment y remédier ?

Commentaire de noSnoR le 03/04/2005 08:14:50

Mmmmh je suis sous firefox et ça ne marche pas... le tableau avec le titre s'affiche (très zoli d'ailleur) mais le texte ne defile pas, sachant que je n'ai pas modifié la source...

Commentaire de Bassman le 23/11/2005 11:31:51

Voila noSnoR, j'ai effectué certaine modification pour que cela fonctionne sur a peut pres tous les navigateurs,

j'ai changé un peu le code et rajouté des commentaires la ou j'ai effectué des modifs,

Test effectué sur {IE 6, Firefox 1.0.7, Mozilla 1.7, Netscape 7} => Tout OK

enjoy :)

[CODE]

<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT>
function NewsInit(){
     //    positionnement du block mainnews

// ICI IL VAUT MIEU UTILISE document.getElementById() QUI EST SUPPPORTE
// PAR UNE GRANDE PARTIE DES NAVIGATEUR

// Test effectué sur {IE 6, Firefox 1.0.7, Mozilla 1.7, Netscape 7} => Tout OK
document.getElementById("mainnews").style.left = document.getElementById("NewsContent").offsetLeft + document.getElementById("NewsReader").offsetLeft +4;
     document.getElementById("mainnews").style.top = document.getElementById("NewsContent").offsetTop + document.getElementById("NewsReader").offsetTop
     document.getElementById("mainnews").style.width = document.getElementById("NewsContent").offsetWidth -1
     document.getElementById("mainnews").style.height = document.getElementById("NewsContent").offsetHeight - 1
    ScrollNews()
}
var newsblock
var topinit = 150    //    point de depart
var Index = 0    //    index dans la collection de news
var OldIndex = 0    //    index d'avant
var Top = topinit    //    valeur courante
var start = 1
// ICI ON DECLARE UNE VAR QUI CONTIENT UN ENTIER, QUI CORRESPOND
// ON NOMBRE DE NEWS, GENERALEMENT CA SERA DONNE PAR UNE REQ SQL
var nbnews = 3 // de 0 à 2 => 3
function ScrollNews(){
     if (Top == 4)
         {
             OldIndex = Index
// SI Index SUP OU EG A nbnews - 1 sois news2 DONC DERNIERE NEWS A AFFICHER
// ALORS Index= 0
// SINON INCREMENT Index
             Index >= (nbnews - 1) ? Index = 0 : Index++
             Top = topinit
             setTimeout("ScrollNews()",2000)
             start=0
             return false
         }
     if (Top == (topinit-1)) {document.getElementById("news" + OldIndex).style.top = topinit}
     Top--
     document.getElementById("news" + Index).style.top = Top
     if (start==0){document.getElementById("news" + OldIndex).style.top = Top-146}
     setTimeout("ScrollNews()",5)
}
</SCRIPT>
<STYLE>
.NewsBlock{display: block; position: absolute; top: 150; left: 0; font: 12 Arial; width:222; border: 1 solid black}
.NewsHead{color: black; background: #B5B5B5;}
.NewsContent{width:220; font: 12 Courier New; background: #F3F3F3; padding: 2 2 2 2;}
.NewReaderBlock{border: 1px solid black ; width: 232; height: 150;background: black; color: white; font: 14 Arial; text-align: center}
.NewReaderContent{height: 125; background: white}
.MainContent{border: none; position: absolute; left: 0; top: 0; width: 100; height: 100; clip: rect(0,222,125,0 ); background: transparent}
</STYLE>
</HEAD>
<BODY onload="NewsInit()">
  
<TABLE ID="NewsReader" CLASS="NewReaderBlock" CELLPADDING=0 CELLSPACING=0 ALIGN="center">
   <TR><TD><B>. : : Les nouvelles neuves : : .</B></TD></TR>
   <TR><TD ID="NewsContent" CLASS="NewReaderContent">&nbsp;</TD></TR>
</TABLE>
<DIV ID="mainnews" CLASS="MainContent">
  
  <!-- ET ON CHANGE LE ID="news" PAR ID="newsX" OU X CORRESPOND A L'ID DE LA NEWS -->
  <!-- LA 0 -->
<TABLE CLASS="NewsBlock" ID="news0" CELLSPACING=0 CELLPADDING=1 BORDER=0>
       <TR CLASS="NewsHead"><TD>Le but</TD></TR>
       <TR><TD CLASS="NewsContent">Faire défiler<BR>toutes formes de balises HTML,<BR>tableaux et autres ...</TD></TR>
</TABLE>
  <!-- ICI 1 -->
<TABLE CLASS="NewsBlock" ID="news1" CELLSPACING=0 CELLPADDING=1 BORDER=0>
       <TR CLASS="NewsHead"><TD>Simplicité</TD></TR>
       <TR><TD CLASS="NewsContent">Vous pouvez y mettre tout<BR>ce que vous voulez.</TD></TR>
</TABLE>
  <!-- ENFIN 2, DE 0 A 2 CA FAIT 3 DONC nbnews = 3 -->
<TABLE CLASS="NewsBlock" ID="news2" CELLSPACING=0 CELLPADDING=1 BORDER=0>
       <TR CLASS="NewsHead"><TD>Autant que vous voulez</TD></TR>
       <TR><TD CLASS="NewsContent">Et même un peu de pub ....<BR><A HREF="www.systeme-d.net" TARGET="_blank">Systeme D</A><BR>Mais non j'en profite pas ;o)</TD></TR>
</TABLE>
  
</DIV>
  
</BODY>
</HTML>

[/CODE]

merci francktfr pour ton code, manque un peu de commentaire :)

Commentaire de bbcluny le 29/11/2005 15:14:22

Merci pour la modif .

Commentaire de allamah le 06/12/2008 15:30:35

bonjour
je souhaiterai integrer cette source a mon site deja créer et recupperer des infos ds la bd pour les afficher.
Déja en faisant un copier coller ça ne pass pas.
J'ai aussi essayer un include_once(news.php) là aussi c'est bizarre. (les news passent ds le coin droit de la page mais pas dans le cadre prevu a cet effet.
NB: J'ai pas encore essayer de lareloer a ma base de donner
MERCI DE ME DONNER DES SOLUTIONSD POUR MON PROBLEME !!!

Commentaire de Danse24 le 31/12/2008 23:24:02

Bonsoir,

Merci beaucoup pour ce script efficace.

Sky

Commentaire de gaston_gb le 03/06/2009 02:23:42

Merci bien pour ce script ;)

 Ajouter un commentaire




Nos sponsors


Sondage...

CalendriCode

Mai 2012
LMMJVSD
 123456
78910111213
14151617181920
21222324252627
28293031   

Consulter la suite du CalendriCode

A découvrir



 
Développement réalisé par Nicolas SOREL (Nix) avec l'aide de : Cyril DURAND et Emmanuel (EBArtSoft), 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

Google Coop CodeS-SourceS Google Coop CodeS-SourceS
Temps d'éxécution de la page : 0,562 sec (4)

Nous contacter | Annoncer sur CodeS-SourceS | Mentions légales