HTML DOM Attributes

INICIO

The length Property

Flower

Los atributos de la imagen son:


CODE

<h2>The length Property</h2>

<img id="myImg" alt="Flower" src="https://images.ctfassets.net/hrltx12pl8hq/28ECAQiPJZ78hxatLTa7Ts/2f695d869736ae3b0de3e56ceaca3958/free-nature-images.jpg?fit=fill&w=1200&h=630" width="550" height="413">

<p>Los atributos de la imagen son:</p>
<p id="demo"></p>

<script> const nodeMap = document.getElementById("myImg").attributes; let text = ""; for (let i = 0; i < nodeMap.length; i++) { text += nodeMap[i].name + " = " + nodeMap[i].value + "<br>"; } document.getElementById("demo").innerHTML = text; </script>