Hi, i am a happy user of MochiKit, well, i need to apply opacity
filter to a tr element, (table row) but it works in firefox and do not
work on MSIE, i cannot understand why, then when i read the msfn, i
got it, the problem is the "opacity filter" does not work on tr
elements, and then i made some modifications to a setOpacity function,
i post it, maybe can be useful.
setOpacity: function (elem, o) {
elem = MochiKit.DOM.getElement(elem);
var self = MochiKit.Style;
if(/MSIE/.test(navigator.userAgent) &&
elem.nodeName.toLowerCase()
== "tr") {
var cellTags = ['TD', 'td', 'th', 'TH'];
while( cellTag = cellTags.shift()) {
if(cellsList =
elem.getElementsByTagName(cellTag)) {
for(i=0;i<cellsList.length;i++)
self.setOpacity(cellsList[i],
o);
}
}
} else {
if (o == 1) {
var toSet = /Gecko/.test(navigator.userAgent)
&& !(/Konqueror|
AppleWebKit|KHTML/.test(navigator.userAgent));
elem.style["opacity"] = toSet ? 0.999999 : 1.0;
if (/MSIE/.test(navigator.userAgent)) {
elem.style['filter'] =
self.getStyle(elem,
'filter').replace(/alpha\([^\)]*\)/gi, '');
}
} else {
if (o < 0.00001) {
o = 0;
}
elem.style["opacity"] = o;
if (/MSIE/.test(navigator.userAgent)) {
elem.style['filter'] =
self.getStyle(elem,
'filter').replace(/alpha\([^\)]*\)/gi, '') +
'alpha(opacity=' + o * 100 + ')';
}
}
}
},
cheers
Felipe.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"MochiKit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/mochikit?hl=en
-~----------~----~----~----~------~----~------~--~---