School of Computing  |  Napier  |  Cisco  |  SFC  |  NOS  |  Code |  Old page

DHTML - Filters - Alpha()

DHTML supports a range of filters using the filters property, which sets the filters on an ob-ject or retrieves them from an object. Its basic format is:

object.style.filter [ = sFilter]

where sFilter are in the form:

filtertype (parameter1, parameter2,...)

The alpha filter sets the opacity for the object. Its syntax is:

object.style.filter = "alpha(sProperties)"

or as HTML with:

<ELEMENT STYLE = "filter: alpha(sProperties)" ... >

The properties include:

" enabled. Sets/retrieves whether the filter is currently enabled.
" finishOpacity. Sets/retrieves the opacity level.
" finishX. Sets/retrieves the x-coordinate of the point at which the opacity gradient ends.
" finishY. Sets/retrieves the y-coordinate of the point at which the opacity gradient ends.
" Opacity. Sets/retrieves the opacity level.
" startX. Sets/retrieves the x-coordinate of the point at which the opacity gradient starts.
" startY. Sets/retrieves the y-coordinate of the point at which the opacity gradient starts.
" Style. Sets/retrieves the shape characteristics of the opacity gradient.

The following gives an example of changing the opacity property on a graphic:

<ELEMENT STYLE = "filter: alpha(sProperties)" ... >

DHTML example

<div id = "pic" style = "position: absolute; filter: alpha( style = 2, opacity = 100, finishopacity = 0 ); z-index: 2; left: 160px; top: 149px">
<img src="pics_cookie.jpg" width="600" height="450">
</div>


 

Executed code

Here's a picture of our cat (Cookie) with an applied filter.

 

 

School of Computing  |  Napier  |  Cisco  |  SFC  |  NOS  |  Code |  Old page

Page maintained by bill