Conceptual question about functions within functions
<p>How come when I use the following code, clicking on "Click Here" doesn't trigger an alert? Why can't I call methods of things other than the window object? E.g. a method of the test1 function?</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;

function test1() {
    test1.test2 = function() {
        alert('Test');
    }
}

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div onClick="test1.test2()"&gt;Click Here&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
