getExpression Method

DHTML, HTML, & CSS

getExpression Method


Retrieves the expression for the given property.

Syntax

vExpression = object.getExpression(sPropertyName)

Parameters

sPropertyName Required. String that specifies the name of the property from which to retrieve the expression.

Return Value

Variant. Returns a variant value representing the expression of the property.

Remarks

The following syntax sections show how to retrieve an expression from supported cascading style sheets (CSS) attributes and Dynamic HTML (DHTML) properties.

  • Use this syntax to retrieve an expression from a read/write property or from an expando property.
    var sExpression = object.getExpression(sPropertyName)
    
  • Use this syntax to retrieve an expression from a CSS attribute.
    var sExpression = object.style.getExpression(sPropertyName)
    

Example

This example uses the getExpression method to set the width of a paragraph equal to the sum of the width of two images. The getExpression method returns 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>
var s;

function getexp()
{
    s=para1.style.getExpression("width");
    alert("Expression for the width of the paragraph is \n\n" 
        + s + "\n\nThe width property has a value of " 
        + oBox3.style.width);
}
</SCRIPT>

Applies To

[ Object Name ]
PlatformVersion
Win16:
Win32:
Mac:
Unix:
WinCE:
Version data is listed when the mouse hovers over a link, or the link has focus.
A, ACRONYM, ADDRESS, AREA, B, BDO, BIG, BLOCKQUOTE, BODY, BR, BUTTON, CAPTION, CENTER, CITE, CODE, COL, COLGROUP, custom, DD, DEL, DFN, DIR, DIV, DL, DT, EM, FIELDSET, FONT, FORM, Hn, HR, I, IFRAME, IMG, INPUT type=button, INPUT type=checkbox, INPUT type=file, INPUT type=hidden, INPUT type=image, INPUT type=password, INPUT type=radio, INPUT type=reset, INPUT type=submit, INPUT type=text, INS, KBD, LABEL, LEGEND, LI, LISTING, MARQUEE, MENU, NOBR, OBJECT, OL, OPTION, P, PRE, Q, RT, RUBY, S, SAMP, SELECT, SMALL, SPAN, STRIKE, STRONG, style, SUB, SUP, TABLE, TBODY, TD, TEXTAREA, TFOOT, TH, THEAD, TR, TT, U, UL, VAR

See Also

dynamic propertiesInternet Link, recalc, removeExpression, setExpression


Back to topBack to top

Did you find this topic useful? Suggestions for other topics? write us!Internet Link

© 1999 microsoft corporation. all rights reserved. terms of useInternet Link.