function getHeight() { var box = document.getElementsByTagName('div'); var heights = new Array(); var x = -1; for (var i = 0; i < box.length; i++) { var temp = box[i]; if(temp.className == 'box_content') { x++; heights[x] = temp.offsetHeight; } } heights.sort(numSort); for (var i = 0; i < box.length; i++) { var temp = box[i]; if(temp.className == 'box_content') { temp.style.height = heights[0] + 'px'; } } } function numSort(a, b) { return (b - a); } function initLoad(func) { var oldonload = window.onload; if (typeof window.onload != 'function'){ window.onload = func; } else { window.onload = function(){ oldonload(); func(); } } } initLoad(getHeight);