Prototype This page is part of the Prototype JavaScript framework documentation.
Overview | (...)

Element.setStyle sets the style of element.

Availability

Available in script.aculo.us V1.5
As of (prototype V1.4.0)

Syntax


  Element.setStyle(element, {cssProperty: value [, ...]});

Examples


<p id="myparagraph">This is just some random text.</p>

<p>
  <a href="#" onclick="Element.setStyle('myparagraph', {textAlign:'right'} ); return false;">
    align right
  </a>
</p>

creates:

This is just some random text.

align right