Image nameProperty

Image 对象参考手册Image Object

Definition and Usage

The name property sets or returns the name of an image.

Syntax

imageObject.name=name


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

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>

Try it Yourself »


Image 对象参考手册Image Object Other Extensions