Re: how do you reference the previous field in a form?
| From: | Ed Lazor | Date: | Mon, 27 Nov 2000 21:09:50 +0000 |
| Subject: | Re: how do you reference the previous field in a form? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-27468@lists.php.net to get a copy of this message | ||
At 09:56 PM 11/27/2000 +0100, you wrote:
Hi! First off all it's document.forms[0].elements[0]Ack, thanks. I didn't notice the typo I had made.
, also you can use document.forms[0].pizza document.forms[0].pizza.selectedIndex is the actually selected field which you can store on a variable during function MyFunction(M1) so the next time MyFunction is called you can access that variable. document.forms[0].pizza.options[#].value document.forms[0].pizza.options[#].text are btw. the correct classes you can changek, I'm with ya so far (I think).... I guess my question is, how do you reference the previous element in the form? If I call MyFunction(this), the function will have a valid reference for the current element. In my case, I store that reference in the variable M1 function MyFunction(M1) {
<previous_field_element>.value = M1.options[M1.selectedIndex].value;} It's that "<previous_field_element>" reference that I'm trying to figure out. Thanks for any info you might have =) -Ed