View Full Version : setExpression()

02-12-2004, 09:07 AM
Hi all,

I am using the following


I have over 20 different elements (DIV's) on the page which I align using this method.

But, after the positioning, the CPU goes to 100% even for trival things such as mouseover() and mouseout()

Please refer to this article for an exmple of what I hoped to do:


Am I doing something wrong?

Any help would be appreciated.

Take Care

02-12-2004, 12:20 PM
If one wants help optimising ones code, one would think that poasting ones code migth help?

02-14-2004, 02:13 AM
please post code. It may have something to do with some infinite loop in the scripting engine.

02-15-2004, 05:19 PM
An expression is a dynamic property - it changes continually. If you set a value on an element using an expression then, depending on how many there are and what else affects the value, it could be very expensive - sometimes too expensive to use.

What you could try is a one-time-use expression (invented by jkd) which is only evaluated once. Here's an example:


It contains two expressions, but only the second is returned - using "this.runtimeStyle" for the second expression removes the dynamic property, and so the value never gets re-evaluated. You can use it to do operations that would otherwise be too intense.