From: Thomas 'PointedEars' Lahn on
David Mark wrote:

> William Wallace wrote:
>> I can't find a definite answer anywhere on when's the right time to
>> use window. and when is the right time to use document. when it comes
>> to prefixing a call to addEventListener or attachEvent.
>>
>> I've seen people using window.addEventlistener for onload, mouse
>> events and I've seen others using document.addEventListener for those
>> same things.
>
> Using window for load is the same as using body for load.

No, it is not. That is one major reason why the `window.onload' approach is
flawed.


PointedEars
--
Use any version of Microsoft Frontpage to create your site.
(This won't prevent people from viewing your source, but no one
will want to steal it.)
-- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
From: David Mark on
On Jul 20, 5:40 pm, Thomas 'PointedEars' Lahn <PointedE...(a)web.de>
wrote:
> David Mark wrote:
> > William Wallace wrote:
> >> I can't find a definite answer anywhere on when's the right time to
> >> use window. and when is the right time to use document. when it comes
> >> to prefixing a call to addEventListener or attachEvent.
>
> >> I've seen people using window.addEventlistener for onload, mouse
> >> events and I've seen others using document.addEventListener for those
> >> same things.
>
> > Using window for load is the same as using body for load.
>
> No, it is not.  That is one major reason why the `window.onload' approach is
> flawed.
>

Okay, technically speaking, it works the same when it works, which is
less often than one could expect the standard body approach to do.