The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

From a quick test, they do seem to be equivalent (at least in Safari), though I've not seen the .item(n) syntax used before. I would probably still use the [n] syntax, because then you can think of .rows as being just a normal array.

Note that I only evaluate .getElementById and row_name= once, and that I've changed the indexing variable from "numrows" to "row_index". "numrows" sounds to me like "the number of rows", but there is never an item at that index, because the row indicies go from 0..(the number of rows - 1).

Also notice that you don't need the eval, and that when accessing variables for the first time, I've put var infront of them, to make sure that they exist in the correct scope.

They are equivalent, and they are equally compatible. The .item() syntax is a result of standardisation, to make it easier for other languages than Javascript, to implement the DOM API. This form is rarely used in Javascript though, so just go with the second one, as everybody else does.

It's generally considered bad practise to use eval, because it can be very hard to follow, and because it's inherently unsafe (Maybe not as much of an issue in Javascript, but still). It is very rare that you have a variable, where you only know its name at runtime, and thus need to use eval() to get at it. You can almost always solve this differently.

In your case, matters are complicated a bit further. Javascript has a "shortcut" build in, which is supposed to make the programmers work easier by relieving him of thinking. Unfortunately, this can lead to some confusion. If there is an element in the HTML document (the DOM), which has an id or name attribute, there will automagically be a global variable in Javascript, which contains a reference to this HTML element. You could - and should - retrieve this element by using the DOM API. Eg. with document.getElementById("foo"), but because it is also available as a global variable with the same name, you can actually access it with eval("foo"). As mentioned, this is definitely not good practise though.