spacer
Yehuda Shiran September 26, 2000
Referencing Different Filters Separately
Tips: September 2000

Yehuda Shiran, Ph.D.
Doc JavaScript

Developer News
Google Chrome Playing Catch-Up on Extensions
Open Solutions Alliance Gets New Leadership
Red Hat Spacewalk Expands Linux Management
The filters attached to an object are grouped under the filters collection. The filters collection can be accessed like any other object collection. One method is through the filter index in the collection. To enable the first filter, for example, of an object with ID=mydiv, you can use the item array:

mydiv.filters.item(0).enabled = true;

Another method is to specify the item's index by its name. In the following example, the script enables the DropShadow filter and disable the Engrave filter. Here is the code, followed by its result. Notice how one filter is referenced by its index and the other filter is referenced by its name:

<DIV ID="mydiv" STYLE="width: 40%; filter: progid:DXImageTransform.Microsoft.engrave() 
progid:DXImageTransform.Microsoft.DropShadow(color='red', OffX=3, OffY=2)">
<IMAGE SRC="bicycle.gif"><FONT COLOR="blue">In this page we explain the basics of 
using filters.</FONT>
</DIV>
<SCRIPT LANGUAGE="JavaScript">
<!--
mydiv.filters.item(1).enabled = 1;
mydiv.filters.item("DXImageTransform.Microsoft.engrave").enabled = 0;
// -->
</SCRIPT>

In this page we explain the basics of using filters.

Notice that the Engrave filter is disabled in the script, and indeed the DIV element is not engraved.

Learn more about filters in Column 68, Introduction to Filters in IE 5.5 and Up.


People who read this tip also read these tips:

Look for similar tips by subject:

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info

Legal Notices, Licensing, Reprints, Permissions, Privacy Policy.
Advertise | Newsletters | Tech Jobs | Shopping | E-mail Offers

webref The latest from WebReference.com Browse >
Popular JavaScript Framework Libraries: An Overview - Part 3 · Accessing Your MySQL Database from the Web with PHP · Working with the DOM Stylesheets Collection
Sitemap · Experts · Tools · Services · Email a Colleague · Contact FREE Newsletters 
 The latest from internet.com
MS Access and MySQL · Cisco AutoQoS: VoIP QoS for Mere Mortals · While VoIP Adoption Explodes in Enterprise, Carrier Spending Lags