is onreadystatechange an event?
Is it possible to do something like this:
this.request.addEventListener('onreadystatechange',handler,false);
were this.request is a XMLHTTRequest object.
| SitePoint Sponsor |
is onreadystatechange an event?
Is it possible to do something like this:
this.request.addEventListener('onreadystatechange',handler,false);
were this.request is a XMLHTTRequest object.


Yes to all the above, though you may with to include IE in what you're doing as well.
Either with advanced event registration with at least the following
Code javascript:if (document.addEventListener) { this.request.addEventListener('onreadystatechange', handler, false); } else if (document.attachEvent) { this.request.attachEvent('readystatechange', handler); }
Or if you know that the object event won't have more than one function assigned to it, you can use the standard event registration instead.
Code javascript:this.request.onreadystatechange = handler;
Last edited by paul_wilkins; Feb 22, 2008 at 01:39.
Programming Group Advisor
Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
Car is to Carpet as Java is to JavaScript
Listening for that event isn't working so I just used the standard event registration.
Bookmarks