Problems getting even basic javascript to work [noob here]
<p>So I am trying to learn javascript. I've gone through a few tutorials and guides, however often they don't teach you how to write javascript to work with web pages. </p>

<p>What I want to learn how to do is provide some basic interactivity with websites I've been making recently. While they contain dynamic content, I still would like some of the interactivity of javascript. All of my attempts have been futile, however, as nothing works. My end goal is to get my websites feeling more professional, and maybe also get a node.js server up and running with some ajax or websockets going to perhaps build a 2d game with canvas, but that is much much later.</p>

<p>The following code is some basic things I've written based on some HTML DOM tutorials I've read. The problem is it doesn't work at all. So can anyone tell me what is going on here, about why it doesn't work at all. And yes, I do have javascript turned on in my browser.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt;

&lt;/head&gt;
&lt;body&gt;
    &lt;p&gt;SomeText&lt;/p&gt;
    &lt;script type="text/javascript"&gt;
        var ptag = document.getElementById('p');

        function alertclick() {
            alert(this);
        }

        for (i = 0; i &lt; ptag.length; i++){
            var attach = ptag[i];
            attach.addEventListener("click", alertclick, false);
        }


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