If I have this HTML
Then this javascript works in IE6
Unfortunately, it seems to me you can only add new elements through the style.filter
property, with filters
you can only manipulate already existing ones.
filter
is a collection object, you can find the docs here: filters Collection. It gives you a nice and easy way to play with your existing filters, you can turn them on and off (enabled
), etc.
For example, you can use
obj.filters.item("DXImageTransform.Microsoft.Alpha").opacity=20;
or (if alpha was you first filter declaration)
obj.filters.item(0).opacity=20;
CLASSES
Most of the time you're better off storing your filter declarations under certain classes in your CSS, and only using JS to assign the right classes instead of manipulating style
values directly.