getElementsByClassName ne marche pas
Bonjour, j'ai un problème avec le fonctionnement de document.getElementsByClassName, du coup je remplace par ElementById, ce qui donne ceci:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| <style>
#prgm,
#flecheg,
#fleched {
text-decoration:underline;
}
#prgm:hover,
#flecheg:hover,
#fleched:hover {
color:red;
cursor: pointer;
}
.img_calculatrice{
width:226.5px;
height:500px;
position:absolute;
left:0px;
padding:0px;
z-index:0
}
#img_prgm,
#img_flecheg,
#img_fleched
{position:absolute;left:0px;z-index:1;width:226.5px;height:500px;background:transparent;padding:0px;}
</style> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| <div style="width:600px;position:relative;padding:0px;">
<span>
Voici à quoi ressemble la calculatrice Ti 82 stats.fr<br />
Je vais vous présenter les différentes fonctions de celle-ci:
</span>
</div>
<div style="width:600px;position:relative;padding:0px;">
<img class="img_calculatrice" style="background:transparent" src="http://www.zupmage.eu/i/qZMDMBhJgd.png"/>
<img id="img_prgm" src="http://www.zupmage.eu/i/nukdjCWy5i.png"/>
<img id="img_flecheg" src="http://www.zupmage.eu/i/OVl3z0vWbj.png"/>
<img id="img_fleched" src="http://www.zupmage.eu/i/kBKtvOinc4.png"/>
</div>
<div style="width:600px;position:relative;padding:0px;">
<span>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
Pour commencer je vais vous dire quoi faire pour créer un programme:<br />
1°) Faites la touche <a id="prgm">prgm</a>, <a id="flecheg">flèche de gauche</a>, et entrée.<br />
2°) Entrez le nom de votre programme, avec les lettres en vert.<br />
3°) Pour quitter l'édition d'un programme, faites 2nde quitter.<br />
4°) Pour retourner à l'édition d'un programme, allez dans <a id="prgm">prgm</a>,<br />
<a id="fleched">flèche de droite</a> (EDIT) et faites entrer sur votre programme.<br />
S'il s'agit du programme en cours sur l'écran principal, faites entrer et ON.
</span>
</div> |
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <script>
var PRGM = document.getElementById('prgm'); //le problème se trouve à cette ligne
var IMG_PRGM = document.getElementById('img_prgm');
var FLECHEG = document.getElementById('flecheg');var IMG_FLECHEG = document.getElementById('img_flecheg');
var FLECHED = document.getElementById('fleched');var IMG_FLECHED = document.getElementById('img_fleched');
IMG_PRGM.style.visibility='hidden';
IMG_FLECHEG.style.visibility='hidden';
IMG_FLECHED.style.visibility='hidden';
PRGM.onmouseover = function(){IMG_PRGM.style.visibility='';};
PRGM.onmouseout = function(){IMG_PRGM.style.visibility='hidden';};
FLECHEG.onmouseover = function(){IMG_FLECHEG.style.visibility='';};
FLECHEG.onmouseout = function(){IMG_FLECHEG.style.visibility='hidden';};
FLECHED.onmouseover = function(){IMG_FLECHED.style.visibility='';};
FLECHED.onmouseout = function(){IMG_FLECHED.style.visibility='hidden';};
</script> |
Du coup, je ne peux faire appraître l'image img_prgm que en survolant le premier prgm, sur le deuxième, ça ne fait rien.
et quand je remplace avec ClassName, le script ne marche pas entièrement.
Merci de votre aide.