[thelist] [JS] window.onload is a liar...

Tom Dell'Aringa pixelmech at yahoo.com
Tue Mar 16 08:43:00 CST 2004

--- Marcus Andersson <marcus at bristav.se> wrote:
> This isn't true (the parts before were).
> Consider the following case:
> var a = new Object();
> a.aMethod = function() {
>    return "hello";
> }
> alert(a.aMethod());
> If you run the example you'll see that a.aMethod evaluates and
> returns a value just as a "normal" function (an anonymous function 
> is a "normal" function as well, you just don't have the same means 
> to reference it).

Okay - so what differentiates:

window.open = Blah(args);


window.open = function() {

Since the first seems to evaluate immediately and cause errors, where
the second seems to wait for the event handler... this is the only
part I can't quite understand.

http://www.Pixelmech.com/ - read my latest blog posting!
http://www.DMXzone.com/ - JavaScript Author
http://SparklesParties.com - Princess parties for little girls!
http://www.thywordistruth.net/ - Eternal Life

"Well, my name's Dewey Oxburger. My friends call me Ox. I dont know if you've noticed, but I got a slight weight problem."

More information about the thelist mailing list