Edit This Code:
<!DOCTYPE html>
<html>
<body>

<img id="myImg" src="w3javascript.gif" style="width:100px;height:132px;">
<br>

<button type="button" onclick="myFunction()">Return width of image</button>

<script>
function myFunction() {
    alert(document.getElementById("myImg").style.width);
}
</script>

</body>
</html>


Result:
Try it Yourself - © w3schools.com
Privacy Policy