title: Add style attribute using javascript on load
body: <p>I'm trying to add a inline-style using JavaScript as soon as the site is loaded (can't use CSS directly due to reasons). I want all text within a table to be horizontally centered, </p>
  
  <p>This is my JavaScript code so far:</p>
  
  <pre><code>window.onload = center_content();
  function center_content (){
      var all_td = document.getElementsByTagName('table');
      all_td[0].style.textAlign = "center !important";
  }
  </code></pre>
  
  <p>Edit: Code corrected so far</p>
  
  <p>jsfiddle:
  <a href="http://jsfiddle.net/GinSan/h46mz6na/4/" rel="nofollow">http://jsfiddle.net/GinSan/h46mz6na/4/</a> (remember that I can't directly use CSS in this case)</p>
  
  <p>Any help is much appreciated. No jQuery solutions please.</p>