Bonjour à tous,
J'ai trouvé sur le net un code JavaScript déjà tout fait me permetant de mettre une fenêtre de texte défilant (vertical) pour mes news. Je l'ai testée et cette fenêtre fonctionne très bien. (Script édité sur l'éditeur JavaScript - http://www.editeurjavascript.com )
Mon problème commence au moment ou je veux mettre 2 fenêtres ou plus dans la même page web, du coup il n'y en a qu'une qui fonctionne et la ou les autre(s) reste(nt) figée(s).
Je ne suis évidament pas programmateur ni webmaster, d'ou mon appel au secours....
Merci d'avance pour votre indulgence pour un novice et pour vos réponses...
Voici le code que j'utilise:
Entre <HEAD> et </HEAD> :
<!-- DEBUT DU SCRIPT -->
<style>
<!--
#tickertape{
position:relative;
layer-background-color:black;
width:750;
height:450;
}
#subtickertape{
background-color:black;
position:absolute;
border: 1px solid black;
width:750;
height:450;
}
.subtickertapefont{
font:bold 14px arial;
text-decoration:none;
color:white;
}
.subtickertapefont a{
color:white;
text-decoration:none;
}
-->
</style>
<!-- FIN DU SCRIPT -->
Entre <BODY> et </BODY>
<!-- DEBUT DU SCRIPT -->
<!--
SCRIPT EDITE SUR L'EDITEUR JAVASCRIPT
http://www.editeurjavascript.com
-->
<div id="tickertape">
<div id="subtickertape" class="subtickertapefont">
<p align="center">Initializing...</div>
</div>
<script language="JavaScript1.2">
/*
Script édité sur l'éditeur JavaScript - http://www.editeurjavascript.com
*/
/*
Fading Ticker Tape Script- © Dynamic Drive (www.dynamicdrive.com)
Fading background color component by Dave Methvin, Windows Magazine
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
var speed=5000
var news=new Array();
news[0]='<a href="http://www.monsite.com/test1.html"><p align="center"><font color="#FF6600"> - Test 1 - <BR><BR><IMG SRC="../images/anim_gif/animation_ete.gif"<BR><BR><BR>Test, Test, Test, l\'Test</a>';
news[1]='<a href="http://www.monsite.com/tennis2.html"><p align="center"><font color="#27ACF8"> - Test 2 - <BR><BR><IMG SRC="../images/anim_gif/animation_hivers.gif"<BR><BR><BR>Test, Test, Test, l\'Test. <BR> Vive le freeride et la binche</a>';
news[2]='<a href="http://www.monsite.com/tennis3.html"><p align="center"><font color="#52BD8A"> - Test 3 - </a>';
i=0
if (document.all)
tickerobject=document.all.subtickertape.style
else if(document.getElementById)
tickerobject=document.getElementById("subtickertape").style
else
tickerobject=document.tickertape.document
function start()
{
if (document.all||document.layers||document.getElementById)
{
regenerate2();
update()
}
}
function regenerate()
{
window.location.reload()
}
function regenerate2()
{
if (document.layers)
setTimeout("window.onresize=regenerate",450)
}
function update()
{
BgFade(0xff,0xff,0xff, 0x00,0x00,0x00,10);
if (document.layers)
{
document.tickertape.document.subtickertape.document.write('<span class="subtickertapefont">'+news[i]+'</span>')
document.tickertape.document.subtickertape.document.close()
}
else if(document.getElementById)
{
document.getElementById("subtickertape").innerHTML=news[i]
}
else
document.all.subtickertape.innerHTML=news[i]
if (i<news.length-1)
i++
else
i=0
setTimeout("update()",speed)
}
function BgFade(red1, grn1, blu1, red2, grn2, blu2, steps)
{
sred = red1; sgrn = grn1; sblu = blu1;
ered = red2; egrn = grn2; eblu = blu2;
inc = steps;
step = 0;
RunFader();
}
function RunFader()
{
var epct = step/inc;
var spct = 1 - epct;
if (document.layers)
tickerobject.bgColor = Math.floor(sred * spct + ered * epct)*256*256 + Math.floor(sgrn * spct + egrn * epct)*256 + Math.floor(sblu * spct + eblu * epct);
else
tickerobject.backgroundColor= Math.floor(sred * spct + ered * epct)*256*256 + Math.floor(sgrn * spct + egrn * epct)*256 + Math.floor(sblu * spct + eblu * epct);
if ( step < inc )
setTimeout('RunFader()',50);
step++;
}
window.onload = start;
</script>
<!-- FIN DU SCRIPT -->
Configuration: Windows XP
Internet Explorer 7.0