<!DOCTYPE html>
<html> <head> <title>ready与onload的性能</title> <meta charset="utf-8"/> <script src="scripts/jquery-1.11.3.js"></script> </head> <script> var startTime = new Date().getTime(); window.onload = function(){ var endTime1 = new Date().getTime(); console.log("onload : "+ (endTime1 - startTime)); } $().ready(function(){ var endTime2 = new Date().getTime(); console.log("ready : " + (endTime2 - startTime)); }); </script> <body> <img src="Koala.jpg"></img> </body></html>
易悦(深圳)科技有限公司
让快乐更简单
微信:EJoyYOJOY
微博:http://weibo.com/EJoyYOJOY
官网:http://www.ejoytec.com/