Why isnt this running?
<p>I have this code below:</p>

<pre><code>&lt;html&gt;

&lt;head&gt;
    &lt;title&gt; Eloquent Javascript Ex 2 &lt;/title&gt;

&lt;script language = "javascript"&gt;

    /*
    function twoPowerTen()
    {
        var result = 1;
        var counter = 0;

        while( counter &lt; 10 )
        {
            result = 2 * result;
            document.writeln( result );
            counter = counter + 1;
        }
    }   

    int limit = 1;

    for( int y = 0; y &lt; 5; y++ )
    {
        for( int x = 0; x &lt; limit; x++ )
        {
            System.out.print( "*" );
        }
        System.out.println();
        limit = limit + 1;
    }
    */

    function drawTriangle()
    {
        var limit = 1;

        for( var y = 0; y &lt; 5; y++ )
        {
            for( var x = 0; x &lt; limit; x++ )
            {
                document.write( "*" );
            }
            document.write( "&lt;br&gt;" );
            limit = limit + 1;
        }
    }

    function whileDrawTriangle()
    {
        var limit = 1;
        var x, y = 0;

        while( y &lt; 5 )
        {
            while( x &lt; limit )
            {
                document.write( "*" );
                x++;
            }
            limit = limit + 1;
            y++;
        }
    }

&lt;/script&gt;

&lt;/head&gt;

&lt;body&gt;
&lt;input type = "button" value = "Draw # Triangle" onClick = "whileDrawTriangle()" /&gt;
&lt;/body&gt;


&lt;/html&gt;
</code></pre>

<p>which doesn't seem to want to run when I hit the button - it's suppose to print a triangle of astericks to the screen. BTW I know the HTML isn't well constructed but the point is to just implement basic javascript as Im getting to grips with it's fundamentals.</p>

<p>What's the problem?</p>

<p>Cheers</p>
