http://www.speedmeter.de/speedtest/
这个网站有四种在线测速方法,一种是Ping,一种是……,我没太看懂,反正是我看过最多的,也是最全的,它采用了Ajax吧,我不会Ajax,我发这个帖子,是想
问,它实现的原理是什么,是这四种方法每一个的实现原理是什么。
我要睡觉了,明天还要上学

解决方案 »

  1.   

    那个网站是作的挺好的,我只知道一个,我收藏了一个,但与那四个差许多
    http://blog.csdn.net/octverve/archive/2007/10/09/1816659.aspx
    我明天也要上班,就不多聊了,@_@
      

  2.   

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link rel="stylesheet" href="index.css" type="text/css">
    <title>速度测试</title>
    </head>
    <body leftMargin="0" topMargin="0" marginwidth="0" marginheight="0">
    <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td>
    <script language="Javascript">
    tim=1
    setInterval("tim++",10)
    b=1
    var autourl=new Array()
    autourl[1]="61.129.251.173"
    autourl[2]="222.138.109.210"
    function check(){
      
      var formplace = ""
      //首页主机放置地点测试
        formplace  = ""
      
      
      if (typeof(formplace)=="object"){
      for (i=0;i<formplace.length;i++)
      {
       if (((formplace[i].value).split("/"))[1]==document.all["hostplace"].innerText)
       {
        formplace[i].selected = true; 
        break;
       }  
      }
      }
    }
    function butt(){
    document.write("<form name=autof action='' onsubmit='check();'><br>")
    for(var i=1;i<autourl.length;i++)
    {
    document.write("<br><br>&nbsp;&nbsp;&nbsp;<input type=text name=txt"+i+" size=44 value=测试中……>")  
    }
    document.write("<br><br>")
    document.write("<p id='anti' style='Display:none'>&nbsp;&nbsp;&nbsp;在您本地访问<font color=red><span id='hostplace'></span></font>机房速度较快,推荐选择.")
    document.write("<input type=hidden name=vstyle value=ok>")
         document.write("<input type=submit name=ok value='刷 新'></p></form>")
    }
    butt()
    function auto(url)
    {
      var urlName;
      if (url=="http://61.129.251.173")
      {
       urlName="中国电信"}
      else
      {
      urlName="中国网通"
      }
      if(tim>4000)
      {document.forms[0]["txt"+b].value=urlName+"链接超时"}
      else
      {
      document.forms[0]["txt"+b].value=urlName+"机房速度指数:"+ adv_format(18000/tim,2) }      
       
            if (b==2){
                 document.all["anti"].style.display='';
               document.all["hostplace"].innerText = (document.forms[0].txt1.value).substr(0,4);
          }
         b++;
    }
    function run()
    {
    for(var i=1;i<autourl.length;i++){ 
    setTimeout("EditTimeout"+i+"('"+autourl[i]+"')",45000)
    //document.write("<img src=http://"+autourl[i]+"/test_pic.jpg?"+Math.random()+" width=1 height=1 onLoad=auto('http://"+autourl[i]+"')> ")
    document.write("<img src=http://"+autourl[i]+"/"+Math.random()+" width=1 height=1 onerror=auto('http://"+autourl[i]+"')>")
        }   
    }
    function EditTimeout1(url)
    {
    var urlName;
    if (url=="61.129.251.173")
       urlName="中国电信"
    else
      urlName="中国网通"
    if(document.forms[0]["txt1"].value =="测试中……")
      document.forms[0]["txt1"].value=urlName+"链接超时"
    else if(document.forms[0]["txt2"].value =="测试中……")
      document.forms[0]["txt2"].value=urlName+"链接超时"
       document.all["anti"].style.display='';
        document.all["hostplace"].innerText = (document.forms[0].txt1.value).substr(0,4);
    }
    function EditTimeout2(url)
    {
    var urlName;
    if (url=="61.129.251.173")
       urlName="中国电信"
    else
      urlName="中国网通"
    if(document.forms[0]["txt1"].value =="测试中……")
      document.forms[0]["txt1"].value=urlName+"链接超时"
    else if(document.forms[0]["txt2"].value =="测试中……")
      document.forms[0]["txt2"].value=urlName+"链接超时"
       document.all["anti"].style.display='';
        document.all["hostplace"].innerText = (document.forms[0].txt1.value).substr(0,4);
    }
    run()
    function MM_openBrWindow(theURL,winName,features) { //v2.0
      window.open(theURL,winName,features);
    }
    function adv_format(value,num) //四舍五入
    {
    var a_str = formatnumber(value,num);
    var a_int = parseFloat(a_str);
    if (value.toString().length>a_str.length)
    {
    var b_str = value.toString().substring(a_str.length,a_str.length+1)
    var b_int = parseFloat(b_str);
    if (b_int<5)
    {
    return a_str
    }
    else
    {
    var bonus_str,bonus_int;
    if (num==0)
    {
    bonus_int = 1;
    }
    else
    {
    bonus_str = "0."
    for (var i=1; i<num; i++)
    bonus_str+="0";
    bonus_str+="1";
    bonus_int = parseFloat(bonus_str);
    }
    a_str = formatnumber(a_int + bonus_int, num)
    }
    }
    return a_str
    }
    function formatnumber(value,num) //直接去尾
    {
    var a,b,c,i
    a = value.toString();
    b = a.indexOf('.');
    c = a.length;
    if (num==0)
    {
    if (b!=-1)
    a = a.substring(0,b);
    }
    else
    {
    if (b==-1)
    {
    a = a + ".";
    for (i=1;i<=num;i++)
    a = a + "0";
    }
    else
    {
    a = a.substring(0,b+num+1);
    for (i=c;i<=b+num;i++)
    a = a + "0";
    }
    }
    return a
    }
         </script>
        </td>
       </tr>
      </table>
    </body>
    </html>这个也与我收藏的那个一样,估计中国是找不到那样的了,去国外的论坛也许会淘到类似的~