Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: setExpression()

  1. #1
    New to the CF scene
    Join Date
    Feb 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question 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
    Regular Coder
    Join Date
    Jul 2002
    Posts
    698
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If one wants help optimising ones code, one would think that poasting ones code migth help?

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Location
    Surrey, UK
    Posts
    119
    Thanks
    0
    Thanked 0 Times in 0 Posts
    please post code. It may have something to do with some infinite loop in the scripting engine.

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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; 02-15-2004 at 07: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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •