Ordered List Iteration in Javascript
<p>Is there a way to allow me to iterate through an ordered list similar in functionality as table.rows? I am using Javascript.</p>

<p>The reason I ask this is because I have an ordered list that contains another ordered list inside. I just want to return the parent list items and not the child.</p>

<pre><code>&lt;ol id="pList"&gt;
    &lt;li&gt;Item A&lt;/li&gt;
    &lt;li&gt;
        &lt;ol id="cList"&gt;
            &lt;li&gt;A's Child 1&lt;/li&gt;
            &lt;li&gt;A's Child 2&lt;/li&gt;
        &lt;/ol&gt;
    &lt;/li&gt;
    &lt;li&gt;Item B&lt;/li&gt;
    &lt;li&gt;Item C&lt;/li&gt;
    &lt;li&gt;Item D&lt;/li&gt;
&lt;/ol&gt;
</code></pre>

<p>I now use getElementsbyTag and that returns all li's including the one in cList. I just want the ones in pList. </p>

<p>Thanks</p>

<p>FYI: I would prefer it done in Javascript. The code has to work within Greasemonkey. I don't really know much about jquery and I am not really much of a javascript programmer. </p>
