An unobtrusive way to load Javscript functions on page load
Javscript:
function addEvent(obj, evType, fn) {
if (obj.addEventListener) {
obj.addEventListener(evType, fn, true);
return true;
} else if (obj.attachEvent) {
var r = obj.attachEvent("on" + evType, fn);
return r;
} else {
return false;
}
}
addEvent(window, 'load', MyFunction);
Comments
Post a Comment