leejunfan
Messages postés45Date d'inscriptionlundi 21 avril 2008StatutMembreDernière intervention 7 août 2008
-
23 mai 2008 à 11:22
leejunfan
Messages postés45Date d'inscriptionlundi 21 avril 2008StatutMembreDernière intervention 7 août 2008
-
23 mai 2008 à 11:45
Bonjour a tous,
Je suis en train de programmer une petite listbox qui doit m'afficher un fond différent en fonction des choix sans recharger la page
voici mon code :
css :
#contact1 {
background: url(img/layerintro.jpg) left top no-repeat;
}
#contact2 {
background: url(img/layer1.jpg) left top no-repeat;
}#contact3 {
background: url(img/layer2.jpg) left top no-repeat;
}#contact4 {
background: url(img/layer3.jpg) left top no-repeat;
}#contact5 {
background: url(img/layer4.jpg) left top no-repeat;
}
Javascript :
function layerContact (idContact) {
for (var i = 1; i<=5; i++) {
document.getElementById('contact'+i).id=idContact;
return false;
}
}
cs_bultez
Messages postés13615Date d'inscriptionjeudi 13 février 2003StatutMembreDernière intervention15 octobre 201330 23 mai 2008 à 11:42
de plus : document.getElementById('contact'+i).id=idContact;
c'est censé faire quoi ? pourquoi vouloir changer l'ID d'un élément ?
<hr /> Cordialement Bul [mon Site] [M'écrire]
Vous n’avez pas trouvé la réponse que vous recherchez ?
leejunfan
Messages postés45Date d'inscriptionlundi 21 avril 2008StatutMembreDernière intervention 7 août 2008 23 mai 2008 à 11:45
Oui le but était de changer d'id afin d'attribuer un css différent
Mais je passe maintenant par des class en identifiant sur un id et cela fonctionne impec ;o)