This file requires two javascript files to work properly. They are behavior.js and css-Query-p.js and can be found in the js/behaviors folder. The script allows you to apply behaviors to a css class, so you don't pollute your html with a ton of inline javascript. The example below uses the following script tag to apply the behaviors. you can also link external javascript files to apply behaviors as well.


Behavior.register(

        ".alert",

        function(element) {

            element.onclick = function(){

                alert('I alert on click');

            }

        }

    );



    Behavior.register(

        ".annoy",

        function(element) {

            element.onmouseout = function(){

                alert('I alert on mouseout, very annoying');

            }

        }

    );



    Behavior.register(

        ".red",

        function(element) {

            element.onmouseover = function(){

                element.style.backgroundColor = 'red';

            }

        }

    );

I am a div that alerts when you click on me - notice I just have class="alert" to make it work :)
I am a div that alerts when you mouseout me - class="annoy" makes it work
I am a div that alerts when you click on me and the background turns red on mouseover - class="alert red"