码迷,mamicode.com
首页 > Web开发 > 详细

测试一个网页的加载速度

时间:2016-05-20 11:54:01      阅读:131      评论:0      收藏:0      [点我收藏+]

标签:

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

<!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  src="images/panda.jpg"/>
</div>
</body>

 

测试一个网页的加载速度

标签:

原文地址:http://www.cnblogs.com/1rui/p/5511323.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!