Share via


Modifying Elements from Script

This is preliminary documentation and subject to change.

Certain element attributes can be modified from script. These attributes are marked as being "animatable" in the HD DVD specification. The animatable properties are:

  • style:x
  • style:y
  • style:width
  • style:height
  • style:opacity
  • style:backgroundFrame
  • style:visibility
  • any of the attributes in the state namespace

There are two ways to change animatable properties from script. The first method is to change the value immediately by using the setProperty(name, value) function. For example:

document.button1.style.setProperty("x","150px");

Or the equivalent shorthand:

document.button1.style.x = "150px";

The other method is to use the animateProperty(property, values, time) function. For example:

document.button1.style.animateProperty("x","0px;150px",5);

Animations from script will override any animations from markup until the unsetProperty function is called

See Also