Return to Snippet

Revision: 49541
at July 25, 2011 00:11 by alberomo

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

Initial URL

Initial Description
Description: Execute different functions when the page loads in a better way than default onload JS event. Include it in the end of the JS document.
Arguments: Name of the function that you want to execute when the page loads.
Author: Simon Willison

Initial Title
addLoadEvent function

Initial Tags

Initial Language