Click to See Complete Forum and Search --> : Troubles with adding options to a select element


qri
April 5th, 2003, 02:53 PM
I'm having troubles with adding options to a select element via JavaScript. Everything works just fine except for in IE 5.0 Win. I get an error saying "this method is not supported by this object." I've tried to figure out what's happening here and found that the alert (only there for debugging purposes) only returns [object] in IE 5.0, but in IE 5.5 and 6.0 and in all versions of NS the alert returns [object OPTION]. This is probably the explanation to why IE 5.0 is choking but what can I do to solve this? I think the other code is ok because everything works just fine in other browsers.

Code sample:

var cartItems = new Option("Items");
alert(cartItems);
parent.cartframe.document.cartform.basket.options[i] = cartItems;