[Project_owners] Image prefetching

Matthew Wilson matthew at mjwilson.demon.co.uk
Sat Apr 2 17:36:40 EST 2005


Eric Jung wrote:
> That's strange because both of these work in both Firefox and IE 6
> for me:
> 
> <script>
> window.onload=hi;
> function hi() {alert("hi");}
> </script>
> 
> and
> 
> <script>
> window.onload=hi();
> function hi() {alert("hi");}
> </script>

Those don't do the same thing.

The first one sets window.onload to call the 'hi' function.

The second one calls the hi() function, and sets window.onload to the 
return value of that function.

Both cause the alert to be generated, but at different times.

Matthew



More information about the Project_owners mailing list