Force javascript to run AFTER a DotNetNuke page is fully loaded

By Unknown | Labels: , , ,

REF

Here's the helper function courtesy of Simon Willison:


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

To use the helper, call it with the name of our target function:

addLoadEvent(msgPgLoaded);


Now our 'msgPgLoaded' function will not fire until the page is fully loaded. Perfect!

0 comments:

Post a Comment