title: Set css properties with a json
body: <p>i've follow the <a href="http://www.w3schools.com/js/js_htmldom_css.asp" rel="noreferrer">w3c</a> description for setting up the css properties of an element with javascript, but i cant figure how to do it with a json object.</p>
  
  <p>my code is this :</p>
  
  <pre><code>var style = {
      position:'fixed',
      top:0,
      right:0,
      bottom:0,
      left:0,
      background:'red'
  }
  
  
  var el = document.getElementById( 'some_id' );
  for( var key in style ){
      el.style.key = style[key]
  }
  </code></pre>
  
  <p>but when a run my script i get "Uncaught TypeError: Cannot read property 'style' of null"</p>