javascript onclick not working
<p>i have this simple code i just can't get it working.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;script type="text/javascript"&gt;
window.onload = function () {
  p = document.getElementById("foo");  
 p.click =  function() { alert(p); }; 
 }
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;div id="foo" style="position:relative;width:100px;height:100px;background-color:red;"&gt; &lt;/div&gt;

&lt;/body&gt;

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

<p>Javascript is turned on. If i put () after the function i can get it autorun. But still, the onclick is not working after it. Firebug did not show any errors.</p>
