load javascript after the html has rendered
<p>The below script works perfectly fine if the p tag is placed above and script placed below</p>

<pre><code>&lt;p id="dom_intro"&gt;Hello&lt;/p&gt; 

&lt;script&gt;
x=document.getElementById("dom_intro");
document.write("&lt;p&gt;This is the text of dom intro" + x.innerHTML + "Howzzat &lt;/p&gt;");
&lt;/script&gt;
</code></pre>

<p>If the same code where the script is placed first and html p tag is placed below the script it does not work, I am getting error x is null or undefined</p>

<pre><code>&lt;script&gt;
x=document.getElementById("dom_intro");
document.write("&lt;p&gt;This is the text of dom intro" + x.innerHTML + "Howzzat &lt;/p&gt;");
&lt;/script&gt;

&lt;p id="dom_intro"&gt;Hello&lt;/p&gt; 
</code></pre>

<p>I tried pasting the script in external javascript file and placed at the head section
I am getting the same error. Is there any javascript or jquery script to load the javascript file after the html has rendred</p>
