Changement background auto sur IE
Bonsoir,
J'ai créé une chtite fonction qui me permet de changer automatiquement le background de mon site toutes les 5 secondes. Le code marche sur FF mais pas sous IE, j'ai testée diverses solutions sans arriver à mes fins, certains d'entre vous pourront surement m'aider, du moins je l'éspère.
À vot' bon coeur.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
var backgrounds = ["BoxMain.jpg","BoxMain2.jpg","BoxMain3.jpg"];
var i=0;
function changerImageBackground()
{
var testi = i+1;
if (testi > backgrounds.length) i=0;
if(document.getElementById)
{
document.getElementById('BoxMain').style.background="url('_pictures/"+backgrounds[i]+"');";
}
i++;
}
setInterval("changerImageBackground()", 5000); |
Merci.