Calling a function into document.getElementById
<p>I'm just trying to replace my P tag with a number list that counts from "1" to "5". But I'm making the numbering part a function. How do I call the function when replacing my P tag? Here is the code I wrote so far.</p>

<pre><code>&lt;script type="text/javascript"&gt;
function countNum() {
    var i=1;
    for (i=1;i&lt;=5;i++) {
    document.write(i+"&lt;br /&gt;");
    }
}
document.getElementById("paragraph").innerHTML=countNum();
&lt;/script&gt;
&lt;/head&gt;

&lt;body&gt;
&lt;p id="paragraph"&gt;
Hello world.
&lt;/p&gt;
&lt;/body&gt;
</code></pre>
