[thelist] [OT] Is fixing on a certain platform/programming language good or bad?
VOLKAN ÖZÇELİK
volkan.ozcelik at gmail.com
Wed Apr 27 16:14:09 CDT 2005
>
> where's the ot tip? ;^)
>
Sorry, I'm a newcomer in the list and I did not get used to the
undocumented rules of it. (if there is somewhere I can learn, or if
someone can tell me off-list, I'd appreciate. Currently I learn by
living it :) )
Here goes the tip:
<tip type="Getting rid of selects" author="Volkan Ozcelik">
As you may know the html <select>s render on the top of any element in
the page, regardless of the elements' z-index. So when you open a
DHTML pop-up layer if there is a select beneath it, the select will
render on the top of the layer, which is unpleasent visually and in
terms of usability.
Here is a DOM-compliant way to show/hide selects:
function DOMController() {}
DOMController.prototype.hideCombos = function() {
var arCombo = document.getElementsByTagName("select");
for(var i=0;i<arCombo.length;i++) {
arCombo[i].style.visibility = "hidden";
}
};
DOMController.prototype.showCombos = function() {
var arCombo = document.getElementsByTagName("select");
for(var i=0;i<arCombo.length;i++) {
arCombo[i].style.visibility = "visible";
}
};
var page = new DOMController();
....
and a possible usage illustration:
function showMyLovelyDHTMLLayer() {
page.hideCombos();
// do rest of the logic.
}
function hideMyLovelyDHTMLLayer() {
// do whatsoever
page.showCombos();
}
...
DOMController has been written as an object so that it can be extended
to suit your needs. The methods showCombos and hideCombos can be used
separately either.
</tip>
cheers,
Volkan.
More information about the thelist
mailing list