How do you access the previous field in a form?

by Ed Lazor <osmosis(at)atfantasy.com>

 Date:  Mon, 27 Nov 2000 12:52:18 -0800
 To:  hwg-style(at)hwg.org
  todo: View Thread, Original
This is a javascript question. I'm hoping I don't piss someone off by
posting my question here, but this is the best place, because I'm sure
someone here knows the answer (it's probably a simple question really).
if I have a form field with an onChange parameter, like this:

<input name=pizza>
<select name=test onChange="MyFunction(this)">

and then in the same document, I define the javascript function, like this:

<script language="JavaScript1.2">
function MyFunction(M1)
{
// hello world
}

How do I reference the value of the field one prior to the one calling the
function? I know that I can do it manually like this:

document.forms[0][elements[0]

In order for my function to work properly, I need it to be more dynamic. I
need it to know how to reference the previous field to change it's value.

Thanks in advance =)

-Ed

HWG hwg-style mailing list archives, maintained by Webmasters @ IWA