Web Analytics Made Easy -
StatCounter setExpression() - CodingForum

Announcement

Collapse
No announcement yet.

setExpression()

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • setExpression()

    Hi all,

    I am using the following

    document.getElementByID('someID').style.setExpression('someExpression')

    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:

    http://www.javascriptkit.com/dhtmltu...property.shtml

    Am I doing something wrong?

    Any help would be appreciated.

    Take Care

  • #2
    If one wants help optimising ones code, one would think that poasting ones code migth help?

    Comment


    • #3
      please post code. It may have something to do with some infinite loop in the scripting engine.

      Comment


      • #4
        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:

        Code:
        width:expression("auto",this.runtimeStyle.width=this.parentNode.currentStyle.width);
        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.
        Last edited by brothercake; Feb 15, 2004, 01:39 PM.
        "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark

        Comment

        Working...
        X