Personal tools
Views

From ProtoScript

Jump to: navigation, search

Contents

YUI:Script Behavior

Runs any valid JavaScript as a behavior.

Example

$proto('#avatar', {
  Click: {
    onClick: {
      Script: {
        javascript: 'YAHOO.util.Dom.setStyle("avatar", 
             "display", "none");
              alert("done!");'
      }
    }  
  }
});

If you can't find a behavior to do what you want, you can always resort to writing JavaScript code directly. The Script behavior allows you to specify a script fragment with the javascript attribute. Here we call the YUI library to set the avatar (image to the left) to hide and then popup an alert.'


Attributes

No Attributes Used. Note Script ignores any target or attributes set.

Callbacks

No Callbacks Provided.

Demo

See Script Demo