Conditional logic if column cell is null
<p>I want to loop through rows on a table and only execute a change background color if <code>column2</code> cells contain no values or empty cells. This is what I have now but all my rows are colored and I only need the logic applied when cells in <code>column2</code> are empty.</p>

<p>JS:</p>

<pre><code>// loops through rows
for (var i = 0; rows; rows = tbody.rows[i]; i++) {
    //loops through cells
    for (var j = 1; col; col = rows.cells[j]; j++) {
        //gets cells of current row
        cells = rows[i].getElementsByTagName('td');
        //gets cells of col 1
        ocells = rows.cells[j].getElementByTagName('td');

        while (rows.cells[j] === null) {
            //condition here&gt;&gt;
        }
    }
}
</code></pre>

<p>HTML:</p>

<pre><code>&lt;div id="table"&gt;
    &lt;table name="tbody" id="tbody1"&gt;
        &lt;tr&gt; 
            &lt;td&gt;col1 Val1&lt;/td&gt;
            &lt;td&gt;col2 Val2&lt;/td&gt;
        &lt;/tr&gt;
        &lt;tr&gt;
            &lt;td&gt;col1 Val3&lt;/td&gt;
            &lt;td&gt;col2 Val4&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
&lt;/div&gt;
</code></pre>

<p>Any help would be appreciated!</p>
