I recently was asked to create a javascript function that would disable flash objects (banner) upon the expansion of a javascript menu. As most of you probably know, any flash object that doesn’t have ‘wmode=transparent’ in it’s PARAM settings will always be the ‘top’ layer.
This can be very frustrating when you have a dropdown menu that gets hidden behind a flash object, but as these flash objects are often banners you don’t want to tell your advertisers you won’t use flash because of a menu.
I’ve found the following javascript function to suit my needs the best:
function togObjects(state) {
hideobj=new Array("embed", "iframe", "object");
for (y = 0; y < hideobj.length; y++) {
objs = document.getElementsByTagName(hideobj[y]);
for(i = 0; i < objs.length; i++) {
objs[i].style.visibility = state;
}
}
}
In the first array you basically determine which objects you want to ‘toggle’, the script loops through all elements on the page and does whatever you please with them. An example:
onFocus="togObjects('hidden');" onBlur="togObjects('visible');"
This would hide all objects you’ve selected (object, embed and iframe in my case) upon putting focus on whatever element you apply the onFocus to. Upon ‘loosing’ focus (onBlur) it would re-enable these objects.

June 21st, 2009
O comments at "Javascript: Hidden (flash) objects"
Comment Now!