Using Javascript to dynamically display a number
<p>This code should generate a page that displays a random number. Why doesn't it work?</p>

<pre><code>&lt;html&gt;
    &lt;head&gt;
        &lt;script type="text/javascript"&gt;
            window.onload = generateRandomNumber();
function generateRandomNumber()
{
    var n = 25;
    var number = Math.floor(Math.random()*n)+1;
    document.getElementById("randomNumber").value = number;
}
&lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
        &lt;h1&gt;
            Random number generated = &lt;h1 id="randomNumber"&gt;&lt;/h1&gt;
        &lt;/h1&gt;
    &lt;/body&gt;
&lt;/html&gt;
</code></pre>
