JavaScript tree
<p>I try to insert into array all the classes</p>

<p>for example</p>

<pre><code>   &lt;div class="class1"&gt;

   &lt;div class="class2"&gt;

   &lt;div class="class3"&gt;

   &lt;div id="class4"&gt;

   &lt;/div&gt; 
   &lt;/div&gt; 
   &lt;/div&gt; 

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

<p>And javascript</p>

<pre><code>      var a=document.getElementById("class4");
  var b=new Array(a.parentNode.className,a.parentNode.parentNode.className,
  a.parentNode.parentNode.parentNode.className);
  for(i=0;i&lt;b.length;i++)
  {alert(b[i])}
</code></pre>

<p>This is work fine but my question is if I don't know how much parentNode there is to 
the class How can I loop all over the parentNode and insert it into the array?</p>
