What is the difference between this two piece of code - newbie question

Giganews Newsgroups
Subject: What is the difference between this two piece of code - newbie question
Posted by:  effen…@epitome.com.sg (Fendi Baba)
Date: 3 Jul 2003

I have encountered 2 variation (at least that's what I think) of
writing javascript to extract the value of a field:

The first being:

document.forms0].fieldname.value

The second being:

document.forms.elements['fieldname'].value

Can someone explain to me what the differences are between the 2, hich
is the one I should be using.

Thank you.

Replies