jnmunsey
11-12-2003, 12:54 AM
Hi, I have searched for help a while and decided to ask now.
I want be able to change the selected item in a dropdown list box(not multiple) via javascript. However, I want to do it based on the value of the option, not the index number.
In IE it is simple:
document.testform.testselect.value="value of item";
In NS though, afaik you have to set the index # of the option:
document.testform.testselect.selectedIndex = item_num;
I really would like to set it based on the VALUE of the option as it works in IE.
You can view a demo of what I am doing at the link below. Both versions work in IE, but only the NS4 version works in NS4.
While these work, I don't want to use the index position of the options. With what I am working on changing via the VALUE is pretty important.
http://www.maxlang.com/test/parent_child/
Thanks
John M
I want be able to change the selected item in a dropdown list box(not multiple) via javascript. However, I want to do it based on the value of the option, not the index number.
In IE it is simple:
document.testform.testselect.value="value of item";
In NS though, afaik you have to set the index # of the option:
document.testform.testselect.selectedIndex = item_num;
I really would like to set it based on the VALUE of the option as it works in IE.
You can view a demo of what I am doing at the link below. Both versions work in IE, but only the NS4 version works in NS4.
While these work, I don't want to use the index position of the options. With what I am working on changing via the VALUE is pretty important.
http://www.maxlang.com/test/parent_child/
Thanks
John M