Opening Select Boxes via JS
this should work in any FF and any IE at least back to 5
selectBox = document.getElementById('mySelectBox');
So I have already constructed a js based select box which works however there are some bugs with keystroke scrolling. Also we are needing to have these select boxes interact with a a4j ajax updater. Point being we need the select box. your solution is closer than we have been in teh past but it is still not "opening" the select but rather increasing the size of actual select. The optimum result is the select box displaying its options just as it would if the user had click on the original select box.
okay, if you've already constructed a js select box....your scrolling problem more than likely has to do with how you set up the "items" of the list...try appending them all to a div that drops down when you run the "open" function for your select box...also in the open function call the "focus" method available on that content div, if your scroll is set to auto, you now have an open selectbox with scrolling that should work just like all the other scrolling works on the page....
Last edited by mrhoo; 10-05-2008 at 05:07 PM.
that won't work either....when you call
you are referring to the first child of the select box....the child objects don't have the 'options' property...and the size of the child elements wouldn't impact the state of the select box at any rate....
document.getElementsByName(selectname) returns the first element that has the name you use in place of selectname.
If the element is not a radio or checkbox input, you probably have only one element with that name.
Assuming you pass it the name of a select element, that element has a size attribute and an options array.
Last edited by mrhoo; 10-05-2008 at 11:01 PM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Tags for this Thread