Wikipedia:WikiProject User scripts/Scripts/addOnloadFunction.js

This is an old revision of this page, as edited by Lupin (talk | contribs) at 12:53, 16 October 2005 (rm testing code... oops). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

//

 
var addOnloadFunction=function(f) {
  if (window.addEventListener) window.addEventListener("load",f,false);
  else if (window.attachEvent) window.attachEvent("onload",f);
  else {
    var oldOnload='_old_onload_'+addOnloadFunction.uid;
    addOnloadFunction[oldOnload] = window.onload ? window.onload : function () {};
    window.onload = function() { addOnloadFunction[oldOnload]();  f(); }
    ++addOnloadFunction.uid;
  }
}
addOnloadFunction.uid=0;
//