在Firefox中更改元素不透明度 [英] Change element opacity in Firefox

查看:82
本文介绍了在Firefox中更改元素不透明度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用改变IE浏览器的不透明度。


abc.style.filter =''alpha(opacity =''+ 10 +'')'';


但这不适用于firefox,在firefox中它会抛出错误。


如何更改Firefox中元素的不透明度。

Hi, I can change the lement opacity in IE using.

abc.style.filter = ''alpha(opacity='' + 10 + '')'';

But this dont work in firefox, In firefox it throws error.

How I can change the opacity of an element in Firefox.

推荐答案

On 6 Okt。,19:56,Sunny< sunnyluth ... @ gmail.comwrote:
On 6 Okt., 19:56, Sunny <sunnyluth...@gmail.comwrote:

我可以用IE改变IE中的不透明度。


abc.style.filter =''alpha(opacity =''+ 10 +'' )'';


但这不适用于firefox,在firefox中它会抛出错误。


如何更改元素的不透明度在Firefox中。
Hi, I can change the lement opacity in IE using.

abc.style.filter = ''alpha(opacity='' + 10 + '')'';

But this dont work in firefox, In firefox it throws error.

How I can change the opacity of an element in Firefox.






只有IE了解滤镜效果,如滤镜:alpha(不透明度= 10),

因此Firefox会抛出一个错误,如果你不想使用它们。


我会定义一个跨浏览器的不透明样式定义,比如

Hi,

only IE understands filter effects like filter:alpha(opacity=10),
therefore Firefox will throw an error, if you tyr to use them.

I would define a cross browser opacity style definition, like

展开 | 选择 | Wrap | 行号


10月6日下午3:27,purcaholic< purcaho ... @ googlemail.comwrote:
On Oct 6, 3:27 pm, purcaholic <purcaho...@googlemail.comwrote:

On 6 Okt。,19:56,Sunny< sunnyluth ... @ gmail.comwrote:
On 6 Okt., 19:56, Sunny <sunnyluth...@gmail.comwrote:

我可以改变IE中的lement opacity使用。
Hi, I can change the lement opacity in IE using.


abc.style.filter =''alpha(opacity =''+ 10 +'')'';
abc.style.filter = ''alpha(opacity='' + 10 + '')'';


但这不适用于firefox,在firefox中它会抛出错误。
But this dont work in firefox, In firefox it throws error.


如何更改Firefox中元素的不透明度。
How I can change the opacity of an element in Firefox.






只有IE了解滤镜效果,如滤镜:alpha(不透明度= 10),

因此Firefox会抛出一个错误,如果你不想使用它们。


我会定义一个跨浏览器的不透明样式定义,比如


Hi,

only IE understands filter effects like filter:alpha(opacity=10),
therefore Firefox will throw an error, if you tyr to use them.

I would define a cross browser opacity style definition, like

展开 | 选择 | Wrap | 行号


Sunny meinte:
Sunny meinte:




我尝试过上课。但无济于事。

这就是我所做的。

在我的样式表中我定义了一个类。

.style3 {

不透明度:0.9999;

-moz-opacity:0.9999;

-khtml-opacity:0.9999;

}

然后我将该类应用于对象

element.style3 =" .44" ;;


是这样,我做的是对还是错?
Hi,

I tried using a class. But to no avail.
That''s what I did.
In my style sheet I defined a class.
.style3 {
opacity: 0.9999;
-moz-opacity: 0.9999;
-khtml-opacity: 0.9999;
}
and then I applied that class to the object
element.style3 = ".44";

Is that, What I did is correct or wrong?



如果它是正确的,它会起作用。对吧?


也许你应该先熟悉基础知识......


无论如何,你正在寻找element.className ="节日礼物" ;.动态更改

不透明度需要进行功能测试。类似


if(typeof element.style.filter ===" string"){

element.style.filter =" alpha(opacity) =" + o +")" ;;

}

else {

element.style.opacity ="" + o / 100;

}


Gregor

-
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com :::Bildagenturfürdenalpinen Raum

If it were correct, it would have worked. Right?

Perhaps you should familiarize yourself with the basics first...

Anyway, you are looking for element.className = "style3". Changing the
opacity dynamically requires feature testing. Something like

if(typeof element.style.filter === "string") {
element.style.filter = "alpha(opacity="+o+")";
}
else {
element.style.opacity = ""+o/100;
}

Gregor
--
http://photo.gregorkofler.at ::: Landschafts- und Reisefotografie
http://web.gregorkofler.com ::: meine JS-Spielwiese
http://www.image2d.com ::: Bildagentur für den alpinen Raum


这篇关于在Firefox中更改元素不透明度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆