SHARE
TWEET

Untitled

a guest Sep 14th, 2017 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html><head>
  2. <script type="text/javascript">
  3. function sortNumeric(a,b)
  4. {
  5. return a - b
  6. }
  7.  
  8. function getLongest() {
  9.     parentDiv = document.getElementById("container");
  10.     cols = parentDiv.getElementsByTagName("div");
  11.     colLength = new Array(cols.length);
  12.     for (x=0; x < cols.length; x++) {
  13.         colLength[x] = document.getElementById(cols[x].id).offsetHeight;
  14.     }
  15.     colLength.sort(sortNumeric);
  16.     colLength.reverse();
  17.     return colLength[0];
  18. }
  19. function setColumns() {
  20.     divLen = getLongest();
  21.     parentDiv = document.getElementById("container");
  22.     cols = parentDiv.getElementsByTagName("div");
  23.     for (x=0; x < cols.length; x++) {
  24.         document.getElementById(cols[x].id).style.height = divLen+"px";
  25.     }
  26. }
  27. </script>
  28. <body onload="setColumns()">
  29. <div id="main">
  30. <div id="content">
  31. <div id="container">
  32. <div style="width:40px; background: yellow; float:left;" id="column_1">
  33. 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
  34. </div>
  35. <div style="width:40px; background: green; float:left;" id="column_2">
  36. 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2
  37. </div>
  38. <div style="width:40px; background: blue; float:left;" id="column_3">
  39. 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
  40. </div>
  41. </div>
  42. </div>
  43. </div>
  44. </body>
  45.  
  46. </html>
RAW Paste Data
Top