11548 sujets

JavaScript, DOM et API Web HTML5

Bonjour,
voila j'ai un probleme avec mon onload, je voudrais lancer plusieurs fonctions à partir du onload mais ça ne marche pas, il me lance que la 1er
<body  onload="changer_logos(); changer_logosA(); changer_logosB(); changer_logosC();">


function changer_logos() {
document.getElementById("img_parenaires").src = nom_pm[numero_pm];
document.getElementById("lien_parenaires").href = lien_pm[numero_pm];
numero_pm += 1;
if (numero_pm == nom_pm.length) {numero_pm = 0;}

setTimeout("changer_logos()", 2000);

}
function changer_logosA() {
document.getElementById("img_parenairesA").src = nom_pmA[numero_pmA];
document.getElementById("lien_parenairesA").href = lien_pmA[numero_pmA];
numero_pmA += 1;
if (numero_pmA == nom_pmA.length) {numero_pmA = 0;}
setTimeout("changer_logosA()", 2000);
}
function changer_logosB() {
document.getElementById("img_parenairesB").src = nom_pmB[numero_pmB];
document.getElementById("lien_parenairesB").href = lien_pmB[numero_pmB];
numero_pmB += 1;
if (numero_pmB == nom_pmB.length) {numero_pmB = 0;}
setTimeout("changer_logosB()", 2000);
}
function changer_logosC() {
document.getElementById("img_parenairesC").src = nom_pmC[numero_pmC];
document.getElementById("lien_parenairesC").href = lien_pmC[numero_pmC];
numero_pmC += 1;
if (numero_pmC == nom_pmC.length) {numero_pmC = 0;}
setTimeout("changer_logosC()", 2000);
}


J'ai essayer de finter en mettant toute les fonction dans la même

function changer_logos() {
document.getElementById("img_parenaires").src = nom_pm[numero_pm];
document.getElementById("lien_parenaires").href = lien_pm[numero_pm];
numero_pm += 1;
if (numero_pm == nom_pm.length) {numero_pm = 0;}
document.getElementById("img_parenairesA").src = nom_pmA[numero_pmA];
document.getElementById("lien_parenairesA").href = lien_pmA[numero_pmA];
numero_pmA += 1;
if (numero_pmA == nom_pmA.length) {numero_pmA = 0;}
document.getElementById("img_parenairesB").src = nom_pmB[numero_pmB];
document.getElementById("lien_parenairesB").href = lien_pmB[numero_pmB];
numero_pmB += 1;
if (numero_pmB == nom_pmB.length) {numero_pmB = 0;}
document.getElementById("img_parenairesC").src = nom_pmC[numero_pmC];
document.getElementById("lien_parenairesC").href = lien_pmC[numero_pmC];
numero_pmC += 1;
if (numero_pmC == nom_pmC.length) {numero_pmC = 0;}

setTimeout("changer_logos()", 2000);

}



mais ça ne marche pas non plus ....
avez vous des idées ?
oui elles fonctionnent car quand je passe la changer_logosA en première position dans le onload elle fonctionne ...
Tu as peut-être une erreur JS qui stoppe le processus après l'exécution de la première fonction. On peut voir ta page en ligne ? (au pire tout le code HTML et tout le code Javascript...)