Image nameProperty
Image Object
Definition and Usage
The name property sets or returns the name of an image.
Syntax
imageObject.name=name
Browser Support
![]()
![]()
![]()
![]()
![]()
All major browsers support the name property.
Example
Example
Return the name of an image:
<html>
<body>
<img id="compman" name="compman"
src="compman.gif.html" alt="Computerman" width="107" height="98">
<br>
<script>
document.write("Image name: ");
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("Image name: ");
document.write(document.getElementById('compman').name);
</script>
</body>
</html>
Try it Yourself »
Image Object Other Extensions