Answers for "Real image width with JavaScript"

0

Real image width with JavaScript

// width in pixels
function setImagesWidth(id, width)
{
    var images = document.getElementById(id).getElementsByTagName("img");
    var newWidth = width + "px";
    for (var i = 0; i < images.length; ++i)
    {
        if (images[i].clientWidth > width)
        {
            images[i].style.width = newWidth;
        }                       
    }
}
Posted by: Guest on July-28-2021

Code answers related to "Real image width with JavaScript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language