Select All in Javascript (Firefox extension) not working right
- by leezer3
I'm having some problems with a select all/ none function. (I didn't write it, I'm trying to fix it!)
It currently looks like this:
rsfindmod.SelAll = function(){
document.getElementById("ListBox").selectAll();
document.getElementById("ListBox").focus();
}
It's being used on a dynamically generated set of links, so there's no set number of items in this listbox.
This seems to work most of the time, but randomly it only selects those which are visible at the time. Scrolling the list or hitting the button again seems to normally make it work as expected.
My first (Obvious?) thought was to replace the function entirely with the one from this link for testing:
http://viralpatel.net/blogs/2009/06/listbox-select-all-move-left-right-up-down-javascript.html
Trouble is that I can't get this one to work whatsoever! This gives me the error that
listbox.options is not defined
Any thoughts please?
I'm by no means certain whether it's the original function at fault, or something in the generation of this listbox.