06/22: Javascript > 透明度を変更する
とほほのスタイルシート入門
/**
* change Opacity
* @param string id
* @param integer num 0% to 100%
*/
function _changeOpacity(id, num)
{
if(document.all)
{
document.getElementById(id).style.filter="alpha(opacity=0)";
document.getElementById(id).filters.alpha.opacity = num;
}
else if(ua.indexOf('Gecko')!=-1)
{
document.getElementById(id).style.MozOpacity = (num / 100);
}
}
Array.indexOf in Internet Explorer - soledad penad�s
if(!Array.indexOf){
Array.prototype.indexOf = function(obj){
for(var i=0; i<this.length; i++){
if(this[i]==obj){
return i;
}
}
return -1;
}
}