Q:

Javascript locating hidden field

I have a table with an arbitrary number of rows.  In the first cell in each table is an image with an onclick call to a javascript function, and a hidden field with the ID of the row.  The call to the javascript function looks like:
<td>
    <a href="#" onclick="doSomeAction(this); return false;" title="Do Something">
        <img src="<?php echo($this->baseUrl());?>/images/btn_add.png" width="20" height="20" alt="Add" />
    </a>
    <input type="hidden" name="rowid[]" value="123" />
</td>

In my Javascript, I would like to retrieve the value of the id[] field.  I tried to access it as follows:
var x = obj.parentNode.childNodes;
var i,j = x.length;
for ( i=0; i<j; i++ ) {
    if ( 'rowid[]' == x[i].nodeName.toLowerCase() ) {
        inp.value = x[i].value;
    } else {
        inp.value = 999;
    }
}

In all cases, this returns 999 as the value, indicating that it cannot locate the child node.  What is not being done correctly here? 

A:

x[i].nodeName is the name of the element, e.g. INPUT, A, TD, DIV, etc.   If you want to keep down this path, just check .name or .getAttribute('name')
Also, x should probably be obj.parentNode.parentNode.childNodes since the parentNode is the A tag.