
Javascript HTML DOM Style 对象问题
为什么对document.getElementByID('div').style.filters.alpha.opacity直接赋值出错?example:<script>...
为什么对document.getElementByID('div').style.filters.alpha.opacity 直接赋值出错?
example:
<script>
function new()
{
var div=document.createElement('div');
div.style.background='#666';
div.style.width=100+'px';
div.style.height=100+'px';
div.style.display='block';
div.innerHTML="<span style='text-color:red'>new sample</span>";
div.style.filters.alpha.opacity=80;
document.body.appendChild(div);
}
</script> 展开
example:
<script>
function new()
{
var div=document.createElement('div');
div.style.background='#666';
div.style.width=100+'px';
div.style.height=100+'px';
div.style.display='block';
div.innerHTML="<span style='text-color:red'>new sample</span>";
div.style.filters.alpha.opacity=80;
document.body.appendChild(div);
}
</script> 展开
展开全部
IE浏览器中一般是:
div.filters.alpha.opacity=80;
或者
div.style.filter="Alpha(Opacity=80)";
其他浏览器(opera、Firefox)则是:
div.style.opacity=0.8;
div.filters.alpha.opacity=80;
或者
div.style.filter="Alpha(Opacity=80)";
其他浏览器(opera、Firefox)则是:
div.style.opacity=0.8;
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询