[Javascript] Set all list box drop downs to a single value

David Yee david at amsresponse.com
Fri Jul 18 18:26:22 CDT 2003


Thanks Peter- that should work.

-----Original Message-----
From: Peter Brunone [mailto:peter at brunone.com]
Sent: Friday, July 18, 2003 1:19 PM
To: '[JavaScript List]'
Subject: RE: [Javascript] Set all list box drop downs to a single value


David,

	If you know the names of the checkboxes (BTW, it's a good idea
not to start object names with integers, because it can confuse the
scripting engine), you can just go through a loop like this:

for (i=10001;i<=10003;i++) {
	var newCheckBox = eval("document.formName." + i + "[status]");
	// selectedIndex is the index of the current option (in a
zero-based array)
	newCheckBox.selectedIndex = 3;
	}

	This should get you started; let us know if you have more
questions.

Cheers,

Peter

-----Original Message-----
From: javascript-bounces at LaTech.edu
[mailto:javascript-bounces at LaTech.edu] On Behalf Of David Yee

Hi- how can I set all the drop downs on my form to a single value with
the click of a button?  I've seen ways to do it with checkboxes but I'm
not sure how to do it with drop downs.  The names of the select box
variables are in a number sequence e.g.

<select name=10001[status]>
<option value=N>NOT_STARTED
<option value=I>IN-PROGRESS
<option value=C>COMPLETE
</select>

<select name=10002[status]>
<option value=N>NOT_STARTED
<option value=I>IN-PROGRESS
<option value=C>COMPLETE
</select>

<select name=10003[status]>
<option value=N>NOT_STARTED
<option value=I>IN-PROGRESS
<option value=C>COMPLETE
</select>

Thanks for any help!

David

_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
https://lists.LaTech.edu/mailman/listinfo/javascript


More information about the Javascript mailing list