basta mettere window.onload=nomeFunzione();