javascript问题,,求高手,,在线采纳
<styletype="text/css">div{filter:alpha(opacity:10);opacity:10;background-color:#F03;w...
<style type="text/css">
div{filter:alpha(opacity:10);opacity:10; background-color:#F03; width:100px; height:100px; margin-bottom:20px}
</style>
<script type="text/javascript">
window.onload=function()
{ oimg=document.getElementsByTagName('div');
var i=0;
for(i=0;i<oimg.length;i++)
{
oimg[i].a=10;
oimg[i].onmouseover=function()
{ clearInterval(this.timer);
show(this,100);}
oimg[i].onmouseout=function()
{ clearInterval(this.timer);
show(this,10);}
}
};
function show(qq,it)
{
clearInterval(qq.timer);
qq.timer=setInterval(function()
{ var speed=0;
if(it>qq.a)
{speed=8;}
else
{speed=-8;}
if(it==qq.a)
{clearInterval(qq.timer);}
else{
qq.a+=speed;
qq.style.filter='alpha(opacity:'+qq.a+')';
qq.style.opacity=qq.a/100;}
},30);
};
</script>
</head>
<body>
<input value="text"/>
<div id="img1">
</div>
<div id="img1">
</div>
<div id="img1">
</div>
<div id="img1">
</div>
</body>
这个是多个div淡入淡出效果,,进入页面应该他的透明度是10%,,但是一打开是100%。。当鼠标经过才是100%。。求问 展开
div{filter:alpha(opacity:10);opacity:10; background-color:#F03; width:100px; height:100px; margin-bottom:20px}
</style>
<script type="text/javascript">
window.onload=function()
{ oimg=document.getElementsByTagName('div');
var i=0;
for(i=0;i<oimg.length;i++)
{
oimg[i].a=10;
oimg[i].onmouseover=function()
{ clearInterval(this.timer);
show(this,100);}
oimg[i].onmouseout=function()
{ clearInterval(this.timer);
show(this,10);}
}
};
function show(qq,it)
{
clearInterval(qq.timer);
qq.timer=setInterval(function()
{ var speed=0;
if(it>qq.a)
{speed=8;}
else
{speed=-8;}
if(it==qq.a)
{clearInterval(qq.timer);}
else{
qq.a+=speed;
qq.style.filter='alpha(opacity:'+qq.a+')';
qq.style.opacity=qq.a/100;}
},30);
};
</script>
</head>
<body>
<input value="text"/>
<div id="img1">
</div>
<div id="img1">
</div>
<div id="img1">
</div>
<div id="img1">
</div>
</body>
这个是多个div淡入淡出效果,,进入页面应该他的透明度是10%,,但是一打开是100%。。当鼠标经过才是100%。。求问 展开
3个回答
展开全部
这是css的问题
opacity:10;
修改为
opacity:0.1;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
div{filter:alpha(opacity:10);opacity:0.1; background-color:#F03; width:100px; height:100px; margin-bottom:20px}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询