var o = document.getElementsByClassName('pdf'); var max=0; for (var i = 0; i < o.length; ++i) { var val = o[i].style.width.replace('px', ''); if (val>max) max=val; } alert(max);