From: William Wallace on
Am I right in thinking that I want to use document.addEventListener /
document.attachEvent for the following events?

load, unload, resize, scroll and mousemove.
From: Erwin Moller on
William Wallace schreef:
> Am I right in thinking that I want to use document.addEventListener /
> document.attachEvent for the following events?
>
> load, unload, resize, scroll and mousemove.

Hard to tell.

You can also do it like this:

<body onLoad="whatever();" onUnLoad="whatever2();">

Why do you want to use addEventListener ?
If you give more context, the good people in here can give you better
advise.

Regards,
Erwin Moller


--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
From: William Wallace on
On Jul 20, 5:00 pm, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...(a)spamyourself.com> wrote:
> William Wallace schreef:
>
> > Am I right in thinking that I want to use document.addEventListener /
> > document.attachEvent for the following events?
>
> > load, unload, resize, scroll and mousemove.
>
> Hard to tell.
>
> You can also do it like this:
>
> <body onLoad="whatever();" onUnLoad="whatever2();">
>
> Why do you want to use addEventListener ?
> If you give more context, the good people in here can give you better
> advise.

I'm doing everything from an included JS file, so I don't get to
determine what's in the body tag. I find that on this group, the less
context given the better. They just pick apart everything you say if
you give more detail.
From: Erwin Moller on
William Wallace schreef:
> On Jul 20, 5:00 pm, Erwin Moller
> <Since_humans_read_this_I_am_spammed_too_m...(a)spamyourself.com> wrote:
>> William Wallace schreef:
>>
>>> Am I right in thinking that I want to use document.addEventListener /
>>> document.attachEvent for the following events?
>>> load, unload, resize, scroll and mousemove.
>> Hard to tell.
>>
>> You can also do it like this:
>>
>> <body onLoad="whatever();" onUnLoad="whatever2();">
>>
>> Why do you want to use addEventListener ?
>> If you give more context, the good people in here can give you better
>> advise.
>
> I'm doing everything from an included JS file, so I don't get to
> determine what's in the body tag. I find that on this group, the less
> context given the better. They just pick apart everything you say if
> you give more detail.

Ok, but what is your question then?

This is what you wrote:
--------------------------------------------
Am I right in thinking that I want to use document.addEventListener /
document.attachEvent for the following events? load, unload, resize,
scroll and mousemove.
--------------------------------------------


Is your question if addEventListener() and attachEvent() can add the
named events?
Is your question if there are more methods to add events?
Is your question what browsers support those methods?
Is your question if there are other methods to add eventListeners?
Do you wonder how to use these methods from your JavaScript file?
etc.
So many possibilities. Do you see why I ask?

Anyway: I learned a lot from the following articles:

http://www.quirksmode.org/js/introevents.html
http://www.quirksmode.org/js/events_advanced.html

No doubt somebody will claim that the above articles suck. ;-)

Regards,
Erwin Moller


--
"There are two ways of constructing a software design: One way is to
make it so simple that there are obviously no deficiencies, and the
other way is to make it so complicated that there are no obvious
deficiencies. The first method is far more difficult."
-- C.A.R. Hoare
From: William Wallace on
On Jul 20, 6:07 pm, Erwin Moller
<Since_humans_read_this_I_am_spammed_too_m...(a)spamyourself.com> wrote:
> William Wallace schreef:
> > On Jul 20, 5:00 pm, Erwin Moller
> > <Since_humans_read_this_I_am_spammed_too_m...(a)spamyourself.com> wrote:
> >> William Wallace schreef:
>
> >>> Am I right in thinking that I want to use document.addEventListener /
> >>> document.attachEvent for the following events?
> >>> load, unload, resize, scroll and mousemove.
> >> Hard to tell.
>
> >> You can also do it like this:
>
> >> <body onLoad="whatever();" onUnLoad="whatever2();">
>
> >> Why do you want to use addEventListener ?
> >> If you give more context, the good people in here can give you better
> >> advise.
>
> > I'm doing everything from an included JS file, so I don't get to
> > determine what's in the body tag. I find that on this group, the less
> > context given the better. They just pick apart everything you say if
> > you give more detail.
>
> Ok, but what is your question then?

Here it is again:

Am I right in thinking that I want to use document.addEventListener /
document.attachEvent for the following events?

load, unload, resize, scroll and mousemove.

> This is what you wrote:
> --------------------------------------------
> Am I right in thinking that I want to use document.addEventListener /
> document.attachEvent for the following events? load, unload, resize,
> scroll and mousemove.
> --------------------------------------------

Yes - that's it. I want to know if I should be attaching the events to
document or window for each of those events. I can't find that info
anywhere. I tried asking in another thread and as usual on this forum
the first responses just want to pick apart the question rather than
just answering it.

> Is your question if addEventListener() and attachEvent() can add the
> named events?

No. I know they can. I just want to know if I use document or window.

> Is your question if there are more methods to add events?
> Is your question what browsers support those methods?
> Is your question if there are other methods to add eventListeners?
> Do you wonder how to use these methods from your JavaScript file?
> etc.

No, No, No and No.

> So many possibilities. Do you see why I ask?

Not really.

> Anyway: I learned a lot from the following articles:
>
> http://www.quirksmode.org/js/introevents.htmlhttp://www.quirksmode.org/js/events_advanced.html
>
> No doubt somebody will claim that the above articles suck. ;-)

I wouldn't say they suck, but they didn't have an answer to my
question. Just all the info I already know.