2.3.2.6 setExpression

Quirks Mode and IE7 Mode (All Versions)

Sets an expression for the specified object.

Syntax

 object.setExpression(sPropertyName, sExpression [, sLanguage])

Parameters

sPropertyNameof type DOMString

A required string that specifies the name of the property to which sExpression is added.

sExpressionof type DOMString

A required string that specifies any valid script (JScript, JavaScript, or VBScript) statement without quotations or semicolons. This string can include references to other properties on the current page. Array references are not allowed on object properties included in this script.

sLanguageof type DOMString

An optional string that specifies one of the following values:

JScript

Default. Language is JScript.

VBScript

Language is VBScript.

JavaScript

Language is JavaScript.

Return Value

No return value.

Remarks

The following expression() syntax can be used to set an expression on a CSS attribute in HTML.

 <ELEMENT STYLE="sAttributeName:expression(sExpression)">

The data type of the evaluated expression in the sLanguage parameter must match one of the possible values allowed for the sExpression parameter. If the property or attribute specified by the first parameter requires a string, the data type of the second parameter must be a string. Otherwise, the second parameter is evaluated prior to invoking setExpression, causing the expression to be set to the result of the evaluation.

Authors can use the uniqueID property of an object in an expression to refer back to the object. Using uniqueID is an alternative to specifying an id for expressions that use an object reference.