Propriété namede l'image
Objet Image
Définition et utilisation
La propriété name définit ou renvoie le nom d'une image.
Syntaxe
imageObject.name=name
Prise en charge des navigateurs
![]()
![]()
![]()
![]()
![]()
Tous les principaux navigateurs prennent en charge la propriété name.
Exemple
Exemple
Renvoie le nom d'une image :
<html>
<body>
<img id="compman" name="compman"
src="compman.gif.html" alt="Computerman" width="107" height="98">
<br>
<script>
document.write("Nom de l'image : ");
document.write(document.getElementById('compman').name);
</script>
</body>
</html>
<body>
<img id="compman" name="compman"
src="compman.gif.html" alt="Computerman" width="107" height="98">
<br>
<script>
document.write("Nom de l'image : ");
document.write(document.getElementById('compman').name);
</script>
</body>
</html>
Essayez-le vous-même »
Objet Image Autres extensions