首页 新闻 赞助 找找看

filters[0].opacity 和 style.opacity

0
悬赏园豆:15 [已关闭问题]

大家请帮我看看这个代码为什么不能再火狐里面正确执行呢……急!

辛苦大家!

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
 <style>
     * { font-size:12px;
         width: 74px;
     }
html { margin:0px; padding:0px; overflow:auto; }
body { margin:0px; padding:15px; background-color:buttonface; }
#w { position:absolute; width:480px; height:270px; overflow:hidden; border:2px groove #281; cursor:default; -moz-user-select:none; filter:alpha(opacity=100); }
#t { line-height:20px; height:20px; width:480px; overflow:hidden; background-color:#27C; color:white; font-weight:bold; border-bottom:1px outset blue; text-align:center; }
#winBody { height:248px; width:480px; overflow-x:hidden; overflow-y:auto; border-top:1px inset blue; padding:10px; text-indent:10px; background-color:white; }
</style>
<script>
    var intervalProcess;
    function sssss(o) {
        clearInterval(intervalProcess); var i = 1, s = 0.02;
        intervalProcess = setInterval(function() {
            if (o.filters) {
                if (o.filters[0].opacity > 0) { o.filters[0].opacity = o.filters[0].opacity - 2; }
                  }
            else {  i -= s; o.style.opacity = i; }
        }, 1);
    }
    function xxxxx(o) {
        clearInterval(intervalProcess); var i = 0, s = 0.02;
        intervalProcess = setInterval(function() {
        if (o.filters) {
            if (o.filters[0].opacity < 100) { o.filters[0].opacity = o.filters[0].opacity + 2; }
        }
        else { i += s; var ss = document.getElementById('w'); o.style.opacity = i; }
      }, 1);
  }


 
</script>
</head>
<body>
 
    <input id="Button1" type="button"onclick="xxxxx(w);" value="button" value="aaaa" />
<div id="w" onclick="sssss(this)">
  <div id="t">我不是小强——墙</div>
 <div id="winBody">cnblogs大家好</div>
</div> 
</body>
</html>

问题补充: 谢谢卡索和woody.wu 两位大侠 但是现在现在再FF里面跑还是只可以消失,点击按钮的时候不能显示
wsenmin的主页 wsenmin | 初学一级 | 园豆:165
提问于:2009-11-27 09:45
< >
分享
其他回答(1)
0

filter:alpha(opacity=50);       /* IE */
-moz-opacity:0.5;              /* Moz + FF */
opacity: 0.5;           /* 支持CSS3的浏览器(FF 1.5也支持)*/\

以上是针对png透明背景设置的相关属性

西越泽 | 园豆:10775 (专家六级) | 2009-11-27 11:07
0

   <script>
    var intervalProcess;
    function sssss(o) {
        clearInterval(intervalProcess); var i = 1, s = 0.02;
        intervalProcess = setInterval(function() {
            if (o.filters) {
                if (o.filters[0].opacity > 0) { o.filters[0].opacity = o.filters[0].opacity - 2; }
                  }
            else {  i -= s; o.style.opacity = i; }
        }, 1);
    }
    function xxxxx() {
        o=document.getElementById('w');
        clearInterval(intervalProcess); var i = 0, s = 0.02;
        intervalProcess = setInterval(function() {
        if (o.filters) {
            if (o.filters[0].opacity < 100) { o.filters[0].opacity = o.filters[0].opacity + 2; }
        }
        else { i += s; var ss = document.getElementById('w'); o.style.opacity = i; }
      }, 1);
  }


 
    </script>

</head>
<body>
    <input id="Button1" type="button" onclick="xxxxx();" value="button" value="aaaa" />
    <div id="w" onclick="sssss(this)">
        <div id="t">
            我不是小强——墙</div>
        <div id="winBody">
            cnblogs大家好</div>
    </div>
</body>
</html>

 

ff下要用document.getElementById來獲得對象哦。

woody.wu | 园豆:3621 (老鸟四级) | 2009-11-27 12:51
不知道你是FF什么版本,我用我改过的这段代码能运行的.
支持(0) 反对(0) woody.wu | 园豆:3621 (老鸟四级) | 2009-11-28 17:06
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册