The Filters Demo Tool: Initialization | WebReference

The Filters Demo Tool: Initialization


The Filters Demo Tool

Initialization

We trigger the tool initialization by the BODY statement:

<BODY BGCOLOR="#FFFFFF" onload="displayDefaultFilter()">

The event handler displayDefaultFilter() displays the filter currently selected by default:

function displayDefaultFilter() {
    oImg.src=startImage;
    changeFilter();
    updateFilterCode();
}

We first assign the image:

oImg.src=startImage;

where startImage is defined in the beginning of the script and assigned the value of sunset.jpg. The second command, changeFilter() is the same command we call when the user selects a new filter, and explained earlier in this column. The last function, updateFilterCode(), is also used for every filter change, and explained earlier.

There are two functions we did not cover yet, enableControlObject() and disableControlObject(). They are needed only for the Alpha filter, where some parameters are not applicable together with some other parameters and we need to disable them and enable them upon the user's selections. These functions are quite simple. They just set the control's disabled parameter on and off:

function disableControlObject(controlName) {
  for (x=0; x 

Notice the two iterations we do to find an object. Again, this is done to accommodate both the hidden and visible controls that have the same name.

Next: The code

http://www.internet.com


Produced by Yehuda Shiran and Tomer Shiran
All Rights Reserved. Legal Notices.
Created: September 25, 2000
Revised: September 25, 2000

URL: http://www.webreference.com/js/column69/6.html