As @epascarello mentioned for W3C standard browsers, you should use:
body.addEventListener("load", init, false);
However, if you want it to work on IE<9 as well you can use:
var prefix = window.addEventListener ? "" : "on";
var eventName = window.addEventListener ? "addEventListener" : "attachEvent";
document.body[eventName](prefix + "load", init, false);
Or if you want it in a single line:
document.body[window.addEventListener ? 'addEventListener' : 'attachEvent'](
window.addEventListener ? "load" : "onload", init, false);
Note: here I get a straight reference to the body element via the document, saving the need for the first line.
Also, if you're using jQuery, and you want to use the DOM ready
event rather than when the body load
s, the answer can be even shorter...
$(init);