+ -
当前位置:首页 → 问答吧 → 麻烦,请看下非IE浏览器背景淡出js该如何做

麻烦,请看下非IE浏览器背景淡出js该如何做

时间:2010-05-29

来源:互联网

IE下面这代码没问题,我知道FF下面滤镜不起作用
但不知该去如何实现:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>tt</title> <style type="text/css"> <!-- #ap1{ width:958px; height:auto; min-height:512px; overflow:hidden; background-color:#FFF; filter:alpha(opacity=100); background-attachment: fixed; background-image: url(http://home.blueidea.com/attachment/201005/25/194782_12747543399qOg.jpg); background-repeat: no-repeat; } --> </style> <script type="text/javascript"> function ImageOpacity(){ var i=100,i2=0,Tid1,Tid2; var Speed=30; var ImageID=document.getElementById("ap1"); ImageOpacity1(); function ImageOpacity1(){ ImageID.filters.alpha.opacity=i-=5; Tid1=setTimeout(ImageOpacity1,Speed); if (ImageID.filters.alpha.opacity<=0){ clearTimeout(Tid1); } } } </script> </head> <body> <div id="ap1" class="ap1"></div> <a href="#" onclick="ImageOpacity()">给老猪变</a> </body> </html>
 提示:您可以先修改部分代码再运行
[ 本帖最后由 Zhangcs 于 2010-5-29 10:47 编辑 ]

作者: Zhangcs   发布时间: 2010-05-29


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>tt</title> <style type="text/css"> <!-- #ap1{ width:958px; height:auto; min-height:512px; overflow:hidden; background-color:#FFF; filter:alpha(opacity=100); background-attachment: fixed; background-image: url(http://home.blueidea.com/attachment/201005/25/194782_12747543399qOg.jpg); background-repeat: no-repeat; } --> </style> <script type="text/javascript"> function ImageOpacity(){ var i=100,i2=0,Tid1,Tid2; var Speed=30; var ImageID=document.getElementById("ap1"); ImageOpacity1(); function ImageOpacity1(){ if(ImageID.filters){ ImageID.filters.alpha.opacity=i-=5; Tid1=setTimeout(ImageOpacity1,Speed); if (ImageID.filters.alpha.opacity<=0){ clearTimeout(Tid1); } }else{ ImageID.style.opacity = ((i-=5) / 100); Tid1=setTimeout(ImageOpacity1,Speed); if(ImageID.style.opacity <= 0){ clearTimeout(Tid1); } } } } </script> </head> <body> <div id="ap1" class="ap1"></div> <a href="#" onclick="ImageOpacity();return false;">给老猪变</a> </body> </html>
 提示:您可以先修改部分代码再运行
[ 本帖最后由 aolu11 于 2010-5-29 11:02 编辑 ]

作者: aolu11   发布时间: 2010-05-29

太好了,谢谢

作者: Zhangcs   发布时间: 2010-05-29

相关阅读 更多

热门下载

更多