现在需要测试一下,由本地到其它网站中网页的访问速度,比如sina.com   163.com 下某一页需要多长时间。

解决方案 »

  1.   

    需要利用后台声明一个,时间变量,当开始lode的时候,给时间变量赋值,然后在你加载完的html紧接着写一个JS,记下时间,然后用这个时间减去Lode的时间变量!就是你的加载时间了!
      

  2.   

    FireFox YSlow。
    其实你上FireFox的Addon站点看看,这方面的东东不少。
      

  3.   


    <html>
    <head></head>
    <body>
    <iframe id="frm" src="about:blank" style="visibility:hidden; width:1px; height:1px;" onload="showsudu()"></iframe>
    <p>输入一个网站地址:</p>
    <input id="txt_url" type="text" style="width:300px;" /><input type="button" value="测速" onclick="cesu()" />
    </body>
    <script type="text/javascript">
    var show = false;
    var time = null;
    function cesu()
    {
        var url = document.getElementById("txt_url").value;
        if(!url)return;
        document.getElementById("frm").src = url;
        show = true;
        var d = new Date();
        time = d.getSeconds()*1000+d.getMilliseconds();
    }
    function showsudu()
    {
        if(!show)return;
        var d = new Date();
        time = d.getSeconds()*1000+d.getMilliseconds() - time;
        alert(time+"毫秒");
    }
    </script>
    </html>