js和jquery页面初始化加载函数的方法及先后顺序

  运行下面代码。弹出A、B、C、D、E的顺序:A=B=C>D=E。

  jquery:等待页面加载完数据,以及页面部分元素(不包括图片、视频), 


  js:是页面全部加载完成才执行初始化加载。

<!DOCTYPE html>
<html>
<head>
<title>首页</title>
<script type="text/javascript" src="js/jquery-1.8.0.min.js"></script>
<script>

$(function()
{
    alert("A");
});

$(document).ready(function(){
    alert("B");
});

jQuery(function($) {  
    alert("C");  
});

function loads(){
    alert("D");
};

window.onload=function(){
    alert("E");
};

</script> <body onload="loads();"> </body> </html>
原文地址:https://www.cnblogs.com/itslives-com/p/4646790.html