Re: Window load/unload calling Object.prototype extension method.



Zvt.Fred wrote:
When I extend the Object's prototype like this:

Object.prototype.zvt_hello = function() {
alert("Hello object! (" + this.toString() + ")");
}

var d = new Date();
d.zvt_hello();

var i = new Number();
i.zvt_hello();

I noted that zvt_hello() method is called in window.onload and
window.onunload.
I tested on FF 3.0.8 and IE 6.0.2.

Can anyone explain me why this happens?

You call it there. (That was easy.)


PointedEars
.