Latest web development tutorials

HTML DOM Image name attribute

Image Object Reference Image Object

Definition and Usage

name property sets or returns the name of the image.

grammar

imageObject.name=name


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support attribute name


Examples

Examples

Returns the name of the picture:

<html>
<body>

<img id="compman" name="compman"
src="compman.gif" alt="Computerman" width="107" height="98">
<br>

<script>
document.write("Image name: ");
document.write(document.getElementById('compman').name);
</script>

</body>
</html>

try it"


Image Object Reference Image Object