filters collection
Represents a collection of all filter objects applied to an element.
Visual filters and transitions can be set or retrieved with the filter style property or the filter object.
Syntax:
Properties that reference the object:
| object.filters |
Related HTML objects:
a, abbr, acronym, address, applet, b, bdo, big, blockquote, body, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, frame, frameset, h1, h2, h3, h4, h5, h6, hr, html, i, iframe, img, input:button, input:checkbox, input:file, input:hidden, input:image, input:password, input:radio, input:reset, input:submit, input:text, ins, isindex, kbd, label, legend, li, listing, marquee, menu, nobr, noframes, object, ol, p, plaintext, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp
|
Possible members:
Properties:
Returns an integer that specifies the number of objects in the current collection.
This property is read-only. |
Methods:
[nameOrIndex] |
Returns an object from the current collection by name or index.
Parameters:
Return value:
Returns an filter object.
|
||||||||||||||
item (nameOrIndex) |
Returns an object from the current collection by name or index.
Parameters:
Return value:
Returns an filter object.
|
Example HTML code 1:
This example illustrates the use of the filters collection:
|
||||
<head> <style> #myDiv { position: absolute; left: 40px; top: 60px; filter: alpha(opacity=80) progid:DXImageTransform.Microsoft.Shadow (color=red); } </style> <script type="text/javascript"> function GetFilters () { var div = document.getElementById ("myDiv"); if (div.filters === undefined) { alert ("Your browser doesn't support the filters collection!"); return; } var filter = div.filters["alpha"]; alert ("The alpha opacity is " + filter.opacity); var filter = div.filters["DXImageTransform.Microsoft.Shadow"]; alert ("The color of the shadow is " + filter.color); } </script> </head> <body> <button onclick="GetFilters ();">Get filter settings!</button> <div id="myDiv">Sample division</div> </body> |
||||
|
||||
Did you find this example helpful?
|
External links:
User Contributed Comments