Expand|Select|Wrap|Line Numbers
- // DATA OBJECT CONSTRUCTOR
- function dataObject(id){
- // EVENT
- this.addEventListener("error",function(event){this.err(event)},true);
- // METHOD
- this.err = function(e){
- // ERROR HANDLING HERE
- }
- }
this.addEventListener is not a function
Perhaps I don't fully understand the exact behavior of events and which objects can raise them.
I am able, however, to use addEventListener to an HTML object. This works fine:
Expand|Select|Wrap|Line Numbers
- // DIV OBJECT CONSTRUCTOR
- function divObject(id){
- // ELEMENT
- var div = document.getElementById(id);
- // EVENT
- div.addEventListener("error",function(event){div.err(event)},true);
- // METHOD
- this.err = function(e){
- // ERROR HANDLING HERE
- }
- }