Traversing web page in javascrips
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/5714268/how-to-iterate-through-a-dom-tree">How to iterate through a DOM tree?</a>  </p>
</blockquote>



<p>Could you advise me how to write the following pseudocode in javascript?</p>

<pre><code>for each child of &lt;body&gt;:
  if (tag.haschildren):
    for each tag.child:
       do some action;
</code></pre>

<p>thank you</p>
