I use the popular addLoadEvent as follows for all my JS downloads:
function addLoadEvent(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = func;
} else {
window.onload = function() {
if (oldonload) {
oldonload();
}
func();
}
}
}
addLoadEvent( locationToggle );
addLoadEvent( step1 );
addLoadEvent( step2 );
addLoadEvent( step3 );
addLoadEvent( getCounties );
addLoadEvent( mapSelection);
All that I read suggests that this is a pretty bullet-free way to avoid onload conflicts. Nevertheless, this method does not work better than wrapping functions in the anonymous window.onload function. Both methods cause identical onload conflicts with this feature set.
I load these functions from the same file as the addLoadEvent function itself. I also use calender.js, which is a third-party file that uses mootools 1.2.4 in an additional file. My files do not have Javascript.
Firstly, someone can verify that I have not damaged the code, and I am using it correctly. Secondly, can someone suggest why this does not resolve conflicts?
Javascript.