SoFunction
Updated on 2025-03-01

JS method to obtain the name attribute of web page image

This article describes the method of JS to obtain the name attribute of web page image. Share it for your reference. The details are as follows:

The following JS code can be used to obtain the name attribute of the web page image

<!DOCTYPE html>
<html>
<body>
<img  name="compman"
src="" alt="Computerman" width="107" height="98">
<br>
<script>
("Image name: ");
(('compman').name);
</script>
</body>
</html>

I hope this article will be helpful to everyone's JavaScript programming.