Why doesn't Javascript recognize the HTML class attribute?
<p>Can anyone help me with a Javascript question, please? Why does the following code display only message boxes with the word "null" in them? And I think there are not enough of them either.</p>

<pre><code>&lt;html&gt;
&lt;head&gt;
    &lt;script type="text/javascript"&gt;
        function showElementClasses(node)  {
            var els = node.getElementsByTagName("*");
            for(var i=0,j=els.length; i&lt;j; i++)
                alert(els[i].getAttribute("class"));
                alert("Class: " + els[i].className);
        }

        showElementClasses(document);
    &lt;/script&gt;
&lt;/head&gt;
&lt;body class="bla"&gt;
    &lt;div class="myclass" style="width: 500; height: 400" id="map"&gt;&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>
