Ezilon.com - Target Your Audience, be Seen in Your Region

Firefox and Dropdown list options

You are viewing this site as a guest. Join our community to get your questions answered and share knowledge. Active members may advertise and ask for a website critique.

She has: 72 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
DeveloperModeratorSponsor

He has: 2,666 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
Developer

She has: 830 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: 72 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.