onload先执行
给你一篇文章吧,讲得比我详细,你也比较容易看得懂。http://www.xiamiz.com/a/jiaocheng/20120723/108264.html解析页面加载与js函数的执行 onload or ready