测试一个网页的加载速度

用时间差,来测试整个网页的加载速度

<!DOCTYPE html>
<html>
 <head>
  <title> new document </title>
   <meta http-equiv="content-type" content="text/html;charset=utf-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1">
    <style>
        div{text-align:center;}img{max-width:100%;}
    </style>
     <script type="text/JavaScript">
        var startTime;
        var now1 = new Date();
        startTime = now1.getTime();
        var stopTime;
        function StopFun()
        {
        var now = new Date();
        stopTime = now.setTime(now.getTime() - startTime) / 1000;
        console.log(stopTime);     
        }

    </script>

</head>

<body onload="StopFun()" >
<div>
    <img alt="" src="images/panda.jpg"/>
</div>
</body>

 

posted @ 2016-05-20 11:03  兌_onlyone  阅读(352)  评论(0编辑  收藏  举报