[thelist] JavaScript: Accessing selectedIndex

Tab Alleman talleman at autobex.com
Fri Nov 3 13:35:22 CST 2000

*slapping forehead*   I would have to choose a name that had the same number
of letters as the select had options.  Thanks Scott.  That got me past one
error and on to the next.  The point of my function is that when the user
changes the month in the DReviewMonth box to the last option (which is
blank), it instantly sets the corresponding DReviewDate and DReviewYear
selects to their last options (which are blanks).  Here's how I'm trying to
do it:

	function DateModify(TheSelect)
		if (TheSelect.selectedIndex == (TheSelect.length - 1))
			var DateSelect;
			var YearSelect;
			DateSelect = TheSelect.name;
			YearSelect = TheSelect.name;
			DateSelect.replace(/Month/, "Date");
			YearSelect.replace(/Month/, "Year");
			DateSelect.selectedIndex = (DateSelect.options.length - 1);
			YearSelect.selectedIndex = (YearSelect.options.length - 1);
			return true;

I'm apparently not doing the replace correctly though.  Doing an
alert(DateSelect); after the replace line still yields:  "DReviewMonth" --
it should be "DReviewDate".. right?

More information about the thelist mailing list