Browsing articles tagged with " window object"
Aug 31, 2008

How to handle multiple window events in Javascript

I’ve written a window event handler mainly for handling multiple onload events. The typical way of handling multiple onload events is by creating a helper function that contains all the onload functions and using window.onload to call the helper function.

An example would look something like this,

function onloader()
{
    onload1();
    onload2();
    // and so on...
}
window.onload = onloader;

However, I wanted to write something more object oriented and more elegant. So I wrote my own method which will allow you to add multiple events to the window object. This script is very early in its stage and only allows you to add events. I will probably work on it more if I figure out more uses for it.

So here’s the script.
Continue reading »

Twitter Updates