[Project_owners] addeventlistener for submit

Neil neil at parkwaycc.co.uk
Thu Mar 1 16:21:48 PST 2007


Arturo 'Buanzo' Busleiman wrote:

>I was wondering, mozillazine says that when I use addeventlistener for submit, the "this" object
>changes to what we expect.
>
>I'm playing around with this (from within overlay.js in my extension)
>
>window.addEventListener("submit",function(e) {enigform.onSubmit(e); },false);
>
>handler:
>
>onSubmit: function(e) {
>},
>
>So, I was wondering: How can I see what this and e make available to me?
>
In the event listener itself [function(e)] "this" will be "window" 
because that's what you added the event listener to. In onSubmit "this" 
will be the enigform variable. Meanwhile e.target should be the actual 
form being submitted.


More information about the Project_owners mailing list