[thelist] JS and Dragging in IE5

Richard Bennett richard.bennett at skynet.be
Fri May 24 17:10:01 CDT 2002


<<----- Original Message -----
<<From: "Tom Dell'Aringa" <pixelmech at yahoo.com>
<<Whoops, I just realized where you removed the targElem var declaration in
all but engage. Why does
<<it matter that you take out var=? I get variable undefined if I put it in.
It must have something
<<to do with var scope? I feel like this is a basic concept I am missing
here... (thanks so much by
<<the way.)

Yes, "var" determines the variables scope.

Variables defined with var are only available in the function they are
defined in, and it's "child" functions.
Variables assigned a value without defining using "var" are available to the
whole script.
If you want to code neatly you could define them with "var" at the top of
the script, not required though.

document.body.scrollLeft should return 0 if the page isn't scrolled.
Here the script works fine with that taken out.

Richard.




More information about the thelist mailing list