function img_all() { var img = document.getElementsByTagName('img'); for (var i=0; i<img.length; i++) { if(/red/.test(img[i].className)) imgminimum(img[i]) } }