Sử dụng opactiy trên IE và FF 2008-02-27 06:24:26

<script>
function opacity(obj){
var isNav = navigator.appName == "Netscape";
if(isNav){
obj.style.opacity = 1;
}else{
obj.filters.alpha.opacity=100
}
}
</script>
<div style="width: 200px; border: 1px solid #ccc;opacity:0.4;filter:alpha(opacity=40)" onmouseover="opacity(this);">
<p>This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
</p>
</div>
<script>
function opacity(obj){
var isNav = navigator.appName == "Netscape";
if(isNav){
obj.style.opacity = 1;
}else{
obj.filters.alpha.opacity=100
}
}
</script>
<div style="width: 200px; border: 1px solid #ccc;opacity:0.4;filter:alpha(opacity=40)" onmouseover="opacity(this);">
<p>This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
This is some text that is placed in the transparent box.
</p>
</div>

Tra loi 3 comment(s) TG 2008-02-27 06:24:26

gaulucky92 2008-02-27 11:02:06

Thiếu rồi TG ơi! Code trên chỉ hoạt động trên IE thôi, còn FF thì ko thấy. Cần thêm vào style cái -moz-opacity mới đủ.

Tra loi

TG 2008-02-28 12:12:53

TG chạy bình thường trên FF muh

Tra loi

gaulucky92 2008-02-28 09:41:24

Ờ nhỉ? chắc tại khi vừa load trang mouse đang ở chỗ div sẵn :D

Mà sao IE củ chuối quá, trong CSS chỉ cần cho thêm setting div.text:Hover là chạy ngon trên FF, còn IE lại ko dc...
Thế nên trên net người ta chửi IE quá trời... :D

Tra loi

Y kien