zoukankan      html  css  js  c++  java
  • js实现简单网速测试方法

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
     <head>
      <title> New Document </title>
      <meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
      <meta name="Generator" content="EditPlus">
      <meta name="Author" content="xinmingyang">
      <meta name="Keywords" content="">
      <meta name="Description" content="">
     </head>
    
     <body>
      <SCRIPT language=JavaScript>
         var st = new Date();
    </SCRIPT>
    <IMG  alt="测试图片" src="http://sp2.yokacdn.com/photos/f3/4f/702018/photo_322092_500.jpg"  onload="showspeed();">
    <div id='showtxt'></div>
    <script>
        var arr=["网速低于50KB","网速在50-100KB之间","网速在100-200KB之间","网速在200-300KB之间","视频通讯"];
        function showspeed()  
        {  
            var filesize =35.4;    //measured in KB   
            var et = new Date();  
            var speed = Math.round(filesize*1000)/(et - st);
            document.title=speed;
            var scope=(speed>0 && speed<=50)?0:(speed>50 && speed<=100)?1:(speed>=100 && speed<200)?2:(speed>=200 && speed<300)?3:4;
            alert(scope)
            document.getElementById("showtxt").innerHTML = ("您的下载速度为:" + arr[scope] + " (K/秒)")  
        }  
    </script>
     </body>
    </html>
  • 相关阅读:
    模版的完全特化与偏特化
    [转]windows消息机制(MFC)
    MFC宏常识
    半透明AlphaBlend
    new、operator new、placement new
    DuplicateHandle
    Mac OS X 更新JAMF域控配置
    生成自签名CA+SSL证书
    Office 2016系列下载地址
    Spring Security静态资源访问
  • 原文地址:https://www.cnblogs.com/jenry/p/2933628.html
Copyright © 2011-2022 走看看