[thelist] DHTML Scrolling Area
Noah St. Amand
noah at tookish.net
Mon Jan 14 09:43:01 CST 2008
Hi Lee,
On 14-Jan-08, at 5:35 AM, Lee Kowalkowski wrote:
> On 11/01/2008, Noah St. Amand <noah at tookish.net> wrote:
>> I usually use an addEvent function to attach scripts to
>> window.onload,
>> rather than using <body onload="">. In this case, though, when I run
>> the script at window.onload, box.scrollWidth returns the width of
>> "box", rather than the width of "contents" with everything loaded
>> into
>> it. If I call it in the body tag using "onload", box.scrollWidth
>> returns the width of "contents".
>
> Strange, it shouldn't really matter. Unless you're accidentally
> invoking initScroll instead of assigning it to the onload event, e.g:
>
> addEvent(window, 'load', initScroll()); // accidental immediate
> invokation.
> addEvent(window, 'load', initScroll); // initScroll invoked when
> onload event fires.
I must have been, because it worked when I tried it again.
Thanks very much for all your help.
Cheers,
Noah
More information about the thelist
mailing list