Firefox and Dropdown list options

She has: 88 posts

Joined: Sep 2001

I have a dynamically created dropdown box on this page, which works acceptably in IE (IE adds a blank line, which is okay, I guess), but Firefox adds an "undefined" option to the list of cities. I don't know where it comes from or how to get rid of it. I tried adding blank options, but that's only pushing "undefined" down in the list. Anyone have any experience with this or know how to solve it? All javascript is on that page if you want to look at the code.

TIA for any assistance.

timjpriebe's picture

He has: 2,667 posts

Joined: Dec 2004

In the function addOptions, you have this line:

for (i = 0; i <= optionList.length; i++)'
Remember, in JavaScript, arrays are zero based. So that's going off the end of the array. Change the <= to < and you'll have it, like this:

for (i = 0; i < optionList.length; i++)'
Firefox prefers to let you know about those things. IE assumes that you're already using IE, so you obviously don't know what you're doing and don't care. Laughing out loud

Roo's picture

She has: 840 posts

Joined: Apr 1999

timjpriebe wrote: IE assumes that you're already using IE, so you obviously don't know what you're doing and don't care. Laughing out loud

LMAO!!! Laughing out loud

She has: 88 posts

Joined: Sep 2001

Tim, thanks! It's a canned script I got from somewhere. I didn't have a clue what to look for.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.