js裡面設定DOM節點透明度的函數屬性:filter= "alpha(opacity=" value ")"(相容ie)和opacity=value/100(相容於FF和GG)。
先來看看設定透明度的相容性代碼:
fadeout 函數程式碼:
複製程式碼
程式碼如下:
function fadeout(ele, opacity, speed) {
if (ele) {
var v = ele.style.filter.replace("alpha(opacity=", "").replace(")", "") || ele.style.opacity || 100 ;
v var count = speed / 1000;
var avg = (100 - opacity) / count;
var timer = null;