...

View Full Version : Great window.onload=init; workaround



howie2009
07-25-2009, 02:18 PM
Use:


function addLoadEvent(func)
{
var oldonload = window.onload;
if (typeof window.onload != 'function')
{
window.onload = func;
}
else
{
window.onload = function()
{
oldonload();
func();
}
}
}

addLoadEvent(init);

A1ien51
07-26-2009, 05:07 AM
That is an okay solution, a better one would be something like this: http://ejohn.org/blog/flexible-javascript-events/

Eric



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum