Forum Moderators: open

Message Too Old, No Replies

Please help -- .options method not working in Mac IE 5.0

         

Santhi Thavasi

11:09 am on Jul 12, 2004 (gmt 0)



Hi,

My requirement is to dynamically populate a drop down box (combo box) in a JSP Page, using a javascript function, with some values. This happens on click of some button.

I am using the below function to populate the drop down box. This runs fine in Windows IE, but in MAC, i get a javascript error saying " 'options' is not an object". Can anybody please tell me how to go about this? Is there any other way in which i could populate a drop down box? I need this to work in both Windows and MAC. Please help!

Function used:
// add an option item to the list
function fnAddListItem(obj)
{
optname = new Option("Sample","1",false,false);
obj.options[obj.length] = optname;
}

P.s: 'obj' here is my drop down box.
eval("document.forms[0].drpSampleBox");

Thanks in advance,
-Santhi.

gfguthrie

12:54 am on Jul 13, 2004 (gmt 0)

10+ Year Member



Are you passing the eval() in as the parameter to the function? If you are, it's not necessary, just call it like this:

fnAddListItem(document.forms[0].drpSampleBox);

I'm sure that Mac IE is somehow interpreting what you're trying to do as passing the eval function through as obj, which of course does not have an options property (though I have not tested this, it seems like it could be happening).

Even if you 'need' the eval currently, try what I've suggested, and if it works, then we can start weaning you off of using eval.