From: JR on 4 Jan 2010 19:50 On Jan 4, 3:24 am, Andrew Poulos <ap_p...(a)hotmail.com> wrote: > In IE 8 running in standards mode with this HTML > > <img > id="z012" > alt="Fish" > title="Japanese fish print" > src="images/old-print-fish.jpg" > style="-ms-filter:'alpha(opacity=0)'; > filter:alpha(opacity=0); > opacity:0; > position:absolute; > left:0px; top:0px; width:396px; height:272px;"> I don't recall where I've read this in the huge MSDN site, but I swear that Microsoft recommends the following sequence in a CSS file / stylesheet: -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; / * IE8 */ filter: alpha(opacity=50); /* IE7 */ The order matters here. And you've forgotten the progid. > and this js > > var elem = document.getElementById("z012"); > > alert(typeof elem.style["-ms-filter"]) // this gives undefined > alert(typeof elem.style["filter"]) // this gives string > > If I delete 'ms-filter' from the HTML the two alerts still give the same > response. > > Here > <url:http://msdn.microsoft.com/en-us/library/ms530752%28VS.85%29.aspx> > it says that to script for -ms-filter I'm to use object.style.filter > > So does that mean there's no point checking if -ms-filter is supported? To 'feature-test' only use if (elem.filters) { ... }. You can confirm it on MSDN. Imagine if we had to update all the JS codes around Internet to check for elem.msFilters). GDI! Note: When applying opacity filter to text, mind the "clear-type" bug which occurs in IE7 and 8. -- JR
First
|
Prev
|
Pages: 1 2 Prev: FAQ Topic - What is Ajax? (2010-01-04) Next: Some Javascript newbie questions |