JS method to get the name property of a web page image

  • 2020-05-26 07:41:03
  • OfStack

This article illustrates an example of how JS can obtain the name property of a web page image. Share with you for your reference. The details are as follows:

The JS code below can be used to get the name properties of a web page image


<!DOCTYPE html>
<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>

I hope this article has been helpful to your javascript programming.


Related articles: