untitled

(John Hannent) #1
filter:progid:DXImageTransform.Microsoft.MotionBlur(Strength=
45,Direction=270);}

In Chapter 16, you experiment in depth with dynamic code, which allows you
to change CSS styles while the user is viewing your Web page. For example, if
the user moves the mouse pointer over, say, some small text, its font-size
CSS style can be modified and can then resize from 10 pixels to 25 pixels,
right before their startled eyes. Chapter 16 also covers the related concept
of script programming in depth.

Dazzling with Transition Filters ................................................................


I might get a little ahead of myself here, introducing a bit of scripting(program-
ming for Web browsers), but what the heck? Chapter 16 goes deeper into this
interesting topic. However, just for fun, I want to show you how to trigger
some interesting transition filters (also known as dynamic filters) using script.

When you write script, you have to decide between the two great families of
programming languages: Basic and C. My preference is Basic, but many
people (mostly professional programmers) prefer the C-like scripting language
JavaScript. For this first example, I’ll provide a script for both languages if
you’re interested in comparing them. Here’s the Basic version:

<html>
<head>

<SCRIPT LANGUAGE=vbscript>

dim toggle

function fader

mydiv.filters(0).Apply

if toggle = 1 Then

toggle = 0
mydiv.style.backgroundColor=”indigo”

else
toggle = 1
mydiv.style.backgroundColor=”lime”

end if

mydiv.filters(0).Play

End Function

238 Part III: Adding Artistry: Design and Composition with CSS

Free download pdf