title: javascript flush text
body: <p>I'm trying to change the text in an <code>h3</code> tag, but the changes don't happen until that the function is ended. I want to change the text immediately.</p>
  
  <p>For example:</p>
  
  <pre><code>&lt;h3 id="myText"&gt;&lt;/h3&gt;
  &lt;input type="button" onClick="changeText('Hello');"&gt;
  
  &lt;script type="text/javascript"&gt;
     function changeText(str){
        document.getElementById('myText').innerHTML = str;
     }
  &lt;/script&gt;
  </code></pre>
  
  <p>Is it possible to refresh the screen immediately after changing the text?
  (Like <code>flush()</code> command in C).</p>
  
  <p>Note that if I put an <code>alert</code> after the command, the text is changed immediately:</p>
  
  <pre><code>function changeText(str){
      document.getElementById('myText').innerHTML = str;
      alert('HelloWorld');
  }
  </code></pre>