Style < Element

The style property function operates a bit differently than every other property function. Most property functions take in a single parameter to set the value and no parameters to return the current value. For the Style property function, one parameter must always be provided. If the second parameter is not provided, the current calculated value of the style is returned, otherwise if a value is provided, the value is set.


The first parameter of the Style function can be a style from the Style enumeration of the css style value. Either way, it will be automatically converted into the property form. Below is an example:

var div = $Div("myDiv");
div.Style("border-left-color", "blue");
div.Style(Style.PaddingLeft, "4px");
alert(div.Style("margin")); // returns current margin value

Last edited Mar 27, 2011 at 4:00 PM by dahrkdaiz, version 4


No comments yet.