title: How can I set multiple CSS styles in JavaScript?
body: <p>I have the following JavaScript variables:</p>
  
  <pre><code>var fontsize = "12px"
  var left= "200px"
  var top= "100px"
  </code></pre>
  
  <p>I know that I can set them to my element iteratively like this:</p>
  
  <pre><code>document.getElementById("myElement").style.top=top
  document.getElementById("myElement").style.left=left
  </code></pre>
  
  <p>Is it possible to set them all together at once, something like this?</p>
  
  <pre><code>document.getElementById("myElement").style = allMyStyle 
  </code></pre>