Posts tagged with 'onload'

Chaining fun with window.onload

I set myself a task: write some raw JavaScript for a web page. By raw , I mean no jQuery, no Prototype, no MooTools, just me and the editor. Because I wanted to reduce the effect I had on the global footprint, I declared one global object like so. var FOO = { // stuff initialize : function () { // setup stuff } }; So far so good. I then wanted that initialize() function to run once the page was loaded. The immediate solution was this: window.onload = FOO.initialize; But that causes a problem in that...