title: Javascript to determine table width/height
body: <p>I've got some JavaScript I'm trying to use to define my table width/height to make it fluid across different resolutions. It seems to work fine for the width but I can't get it to work for the height. It is setting the correct number into the correct variable, it's just not setting the tables height. Here's what I got..</p>
  
  <pre><code>&lt;html&gt;
  &lt;head&gt;
  &lt;script type="text/javascript"&gt;
   var viewportwidth;
   var viewportheight;
   var tablewidth;
   var tableheight;
   if (typeof window.innerWidth != 'undefined'){ //set's viewport width/height into respective variables
                viewportwidth = window.innerWidth,
                viewportheight = window.innerHeight
           }else if (typeof document.documentElement != 'undefined'
               &amp;&amp; typeof document.documentElement.clientWidth !=
               'undefined' &amp;&amp; document.documentElement.clientWidth != 0){
                 viewportwidth = document.documentElement.clientWidth,
                 viewportheight = document.documentElement.clientHeight
           }else{
                 viewportwidth = document.getElementsByTagName('body')[0].clientWidth,
                 viewportheight = document.getElementsByTagName('body')[0].clientHeight
           } 
   function asdf(){
   tablewidth = Math.round(viewportwidth/100*70);  //sets table width to 70% of viewport width
   tableheight = Math.round(tablewidth/100*74);    //sets table height to 74% of table width, this number is ambigous
   document.getElementById('poop').innerHTML = tableheight+', '+tablewidth+', viewport width is '+viewportwidth+'x'+viewportheight;
   document.getElementById('container').width = tablewidth;
   document.getElementById('container').height = tableheight;
  }
  &lt;/script&gt;
  &lt;/head&gt;
  &lt;body onload="asdf();"&gt;
  &lt;span id="poop"&gt;&lt;/span&gt;
      &lt;table id="container" cellpadding="0" border="1" cellspacing="0" width="" height=""&gt;
          &lt;tr&gt;&lt;td colspan="5"&gt;&lt;/td&gt;&lt;/tr&gt;
          &lt;tr&gt;
              &lt;td width="38%"&gt;&lt;/td&gt;
              &lt;td width="12%"&gt;&lt;/td&gt;
              &lt;td width="21%"&gt;&lt;/td&gt;
              &lt;td width="14%"&gt;&lt;/td&gt;
              &lt;td width="15%"&gt;&lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Anyone see what I'm doing wrong?</p>