[thelist] JavaScript: Accessing selectedIndex

Scott_Brady at themoneystore.com Scott_Brady at themoneystore.com
Fri Nov 3 13:00:38 CST 2000

I think you'll see that the length property is wrong, too. It's giving you the
length of the word "DReviewMonth". That's because you're passing the function
the string value: 'DReviewMonth' [12 letters] and not the select box.

If you change your select definition to this:  <select name='DReviewMonth'
size='1' onchange=DateModify(this)>

you should be fine.


"Tab Alleman" <talleman at autobex.com> on 11/03/2000 10:54:04 AM

Please respond to thelist at lists.evolt.org

To:   thelist at lists.evolt.org
cc:    (bcc: Scott Brady/TMS)

Subject:  [thelist] JavaScript:  Accessing selectedIndex

In the body of my page, I have the following form element:

<select name='DReviewMonth' size='1' onchange=DateModify('DReviewMonth')>

Ok, then in my script, the beginning of DateModify() goes like this:

function DateModify(TheSelect)
     alert(TheSelect + " - " + TheSelect.length + " - " +

HOWEVER, when I change the select box, the resulting alert box displays:

     DReviewMonth - 12 - undefined

Why?  Why is it accessing the .length property as advertised, but not the
selectedIndex property?  I don't see anything wrong with my script.. does

For unsubscribe and other options, including
the Tip Harvester and archive of TheList go to:
http://lists.evolt.org Workers of the Web, evolt !

More information about the thelist mailing list