Dynamic Properties: Getting a Dynamic Property | WebReference

Dynamic Properties: Getting a Dynamic Property

Dynamic Properties

Getting a Dynamic Property

You can get the expression of a dynamic property with the getExpression() method. It echoed back the exact expression you specify with the setExpression() method. The getExpression() method returned a string. We did not use this method in our Solar System example, but had we used it for the Sun:


We would have gotten the following alert box:

Compare it with the original setExpression() statement:

oSun.style.setExpression("left", "document.body.clientWidth / 2 -
  oSun.style.pixelWidth / 2");

And likewise for the moon, had we issued this line:


we would have gotten:

Compare it with the original setting:

oMoon.style.setExpression("left", "xLocation(oEarth, 0.1, 28,
  currentTime) - oMoon.style.pixelWidth / 2");

Next: How to remove a dynamic property


Produced by Yehuda Shiran and Tomer Shiran

Created: July 18, 2000
Revised: July 18, 2000

URL: http://www.webreference.com/js/column65/4.html