[js]将某个函数放在onload事件中最先执行
1 function addLoadEvent(func)
2 {
3 var oldonload = window.onload;
4 if (typeof window.onload != 'function')
5 {
6 window.onload = func;
7 }
8 else
9 {
10 window.onload = function()
11 {
12 oldonload();
13 func();
14 }
15 }
16