Einstein47
Programmer
I have a question about speeding up the following loop. It is used to iterate through each element on a form and if it is of type "select-one" then it hides it. And it works but it is very slow when the form has a lot of elements. And what is most concerning is that it is still very slow even when the form has no "select-one" elements.
Is there a way to get only the "select-one" elements from the form and then loop through them? I'm thinking that would be faster, but I don't know if that is possible.
Thanks in advance for any suggestions.
Einstein47
For best results: hand wash in cold, tumble dry low.
For not so good results: drag through puddles, pound on rocks, air dry on tree branch.
[[]Starbase47.com]
Is there a way to get only the "select-one" elements from the form and then loop through them? I'm thinking that would be faster, but I don't know if that is possible.
Code:
function PopupMenu_hideSelect() {
for (j=0; j < window.top.window.frames["mainFrame"].document.forms.length; j++) {
var theForm = window.top.window.frames["mainFrame"].document.forms[j];
var numElems = theForm.elements.length;
for(i=0; i < numElems; i++) {
if(theForm.elements(i).type == "select-one") {
theForm.elements(i).style.visibility = "hidden";
}
}
}
}
Thanks in advance for any suggestions.
Einstein47
For best results: hand wash in cold, tumble dry low.
For not so good results: drag through puddles, pound on rocks, air dry on tree branch.
[[]Starbase47.com]