title: Cross-browser dynamic setting of a CSS property
body: <p>I have a function that gets many pieces of data and sets a CSS property for a defined element. </p>
  
  <p>Here is the code: </p>
  
  <pre><code>function setStyle(element,property,target){
       element.style[property] = target;
  }
  
  var EL = document.getElementById("id");
  setStyle(EL,"width","50px");
  </code></pre>
  
  <p>It works well in most browsers but not for IE6–IE9. </p>
  
  <p>I've found <code>document.defaultView.getComputedStyle</code> and <code>element.currentStyle[type]</code>, but these methods get style and I can't use them to set.</p>
  
  <p>Is there any way to do that for old IEs?</p>
  
  <p><strong>i don't want to use jQuery or any other JS library</strong>, thanks.</p>