[Javascript] Monitor an offsetHeight value

Paul Novitski paul at juniperwebcraft.com
Thu Jan 11 13:33:25 CST 2007


At 1/11/2007 08:59 AM, Guillaume wrote:
>I'm trying to build a function that would monitor an offsetHeight value
...
>Here's my unlucky attempt below:
>
>      function checkOptJ(){
>      var opts1 = document.getElementById("options");
>
>      moveBy1 = opts1.offsetHeight;// Initial value
>
>
>
>      function checkOptK(){
>
>      opts44 = document.getElementById("options");
>
>      moveBy22 = opts44.offsetHeight;// Value to be checked
>                 }
>
>         setTimeout("checkOptK();", 2000);
>
>
>     if ( moveBy1 !== moveBy22) {
>
>              alert( "things have moved" );
>
>            }
>
>         }


I see two errors:

1) You haven't closed the curly brace for function checkOptJ()

2) You haven't declared moveBy1 in your root code outside of these 
functions so it will exist as a global variable and thus be known 
inside function checkOptK().

Regards,
Paul 




More information about the Javascript mailing list