DHTML Methods
DOM Level 2 Specification.
Retrieves the expression for the given CSS property.
vExpression = object.getExpression ( sPropertyName )
sPropertyName |
Required. Name of the property from which to retrieve the expression. |
Variant. Returns a variant value representing the expression of the property.
The getExpression method applies to the style object and can be used to return expressions set on supported CSS Attributes. This method is also available in scripting for the innerHTML and value attributes.
Using getExpression in script:
var sExpr = object.getExpression ( sProperty )
Using getExpression on a style:
var sExpr = object.style.getExpression ( sProperty )
This method is Microsoft's® implementation of the generic getPropertyValue interface provided for in the DOM.
The following sample code illustrates the implementation for getExpression. The para1 paragraph's width is set equal to the sum of two images' widths. The getExpression method will return a variant containing the expression.
Sample Code
<p id=para1
style="width:expression ( Img1.width + Img2.width );
back-color:blue" onclick="getexp ( )">
Click here to see the expression.</p>
<script language="JavaScript">
var s;
function getexp ( ) {
s=para1.style.getExpression ( "width" );
alert ( "Expression for paragraph width is \n\n" +
s + "\n\nThe width property has a value of " +
oBox3.style.width );
}
</script>
Dynamic Properties, recalc, removeExpression, setExpression