title: How to set div display value dynamically
body: <p>How to display div dynamically through <code>javascript</code>?</p>
  
  <p>Here is my code</p>
  
  <pre><code>var div = document.createElement("div");
  
  var sBody = "&lt;span style='background-color:#ffffc4;border:2px solid black;height:100%;width:100%;'&gt;";
  
  if (sLabel) {
      sBody += "&lt;span style='font:10pt arial;font-weight:bold;padding-left:2px;text-align:center;width:100%;'&gt;" + sLabel + "&lt;/span&gt;";
  }
  
  sBody += "&lt;/span&gt;";
  
  div.innerHTML = sBody;
  div.style.width = = iW;
  div.style.height = iH;
  div.style.display = 'inline';
  </code></pre>