...

View Full Version : How to hide all drop down boxes on a page?



gurra
10-29-2002, 04:40 PM
I've made a drop down menu that shows/hides different layers. But sometimes there's a drop down box where the menu should appear and then drop down box is placed above the layer.

Now I'm looking for a script that hides all drop down boxes on the page. The problem is I have a lot of pages in my site and different pages have different amount of drop down boxes.

How can I make a script that automatically hides all drop down boxes?

Regards
Gustaf

beetle
10-29-2002, 05:13 PM
function hideAllSelects() {
var collS = document.getElementsByTagName("SELECT");
for (var i=0; i<collS.length; i++)
collS[i].style.visibility = 'hidden';
}

gurra
10-30-2002, 10:36 AM
Thanks very much!

However, the select-boxes are inside an iframe and I can't seem to refer to it the right way.

This is how the script looks now: (the IFRAME is named and ID'd "main")


function hideAllSelects() {
target = document.getElementById("main");
var collS = target.getElementsByTagName("SELECT");
for (var i=0; i<collS.length; i++)



if (collS[i].style.visibility == 'hidden')
{
collS[i].style.visibility = "";
} else
{
collS[i].style.visibility = 'hidden';
}

}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum